example

command
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

gojs example

This shows how to use Wasm built by go using GOARCH=wasm GOOS=js. Notably, this shows an interesting feature this supports, HTTP client requests.

$ cd stars
$ GOARCH=wasm GOOS=js GOWASM=satconv,signext go build -o main.wasm .
$ cd ..
$ go run stars.go
wazero has 9999999 stars. Does that include you?

Internally, this uses gojs, which implements the custom host functions required by Go.

Notes:

  • GOARCH=wasm GOOS=js is experimental as is wazero's support of it. For details, see https://wazero.io/languages/go/.
  • GOWASM=satconv,signext enables features in WebAssembly Core Specification 2.0.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL