Updated WebAssembly (markdown)

Hajime Hoshi 2018-07-06 03:55:53 +09:00
parent 30279bf2dd
commit 12ca64f36b

@ -7,6 +7,12 @@ As there are differences between the latest Go and Go 1.11 beta, I recommend to
After that, use the compiled `go` binary. After that, use the compiled `go` binary.
# Compile your game
```sh
GOOS=js GOARCH=wasm /path/to/latest/gocode/bin/go build -o yourgame.wasm github.com/yourname/yourgame
```
# Create an HTML # Create an HTML
```html ```html
@ -22,7 +28,7 @@ if (!WebAssembly.instantiateStreaming) {
} }
const go = new Go(); const go = new Go();
WebAssembly.instantiateStreaming(fetch("sprites.wasm"), go.importObject).then(result => { WebAssembly.instantiateStreaming(fetch("yourgame.wasm"), go.importObject).then(result => {
go.run(result.instance); go.run(result.instance);
}); });
</script> </script>