From 12ca64f36b35f7a579e5e9ad1e6370f6aa5b3a7e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 6 Jul 2018 03:55:53 +0900 Subject: [PATCH] Updated WebAssembly (markdown) --- WebAssembly.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/WebAssembly.md b/WebAssembly.md index 1cac5e3..ed94e65 100644 --- a/WebAssembly.md +++ b/WebAssembly.md @@ -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. +# 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 ```html @@ -22,7 +28,7 @@ if (!WebAssembly.instantiateStreaming) { } 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); });