diff --git a/README.md b/README.md index 56c5fce1c5abd0b2976ccb64aefa9e62793dadf6..84a3e484f83b8fc0e3d5fe5d8edf5212f42187e5 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,12 @@ directory. Then run the server ```shell $ GOOS=js GOARCH=wasm go build -o test/assets/xxdk.wasm -$ go run test/server/main.go +$ cd test/server/ +$ go run main.go ``` +Navigate to http://localhost:9090 to see the web page. + ## `wasm_exec.js` `wasm_exec.js` is provided by Go and is used to import the WebAssembly module in @@ -62,7 +65,7 @@ global.Go = class { go: { // ... // func Throw(exception string, message string) - 'gitlab.com/elixxir/client/wasm.Throw': (sp) => { + 'gitlab.com/elixxir/xxdk-wasm/wasm.Throw': (sp) => { const exception = loadString(sp + 8) const message = loadString(sp + 24) throw globalThis[exception](message) diff --git a/main.go b/main.go index ccbe089a3ed8d4b26e2436079252981e735718cf..9f337d87a1d8dfd4b6f5a361d7054b29c132f761 100644 --- a/main.go +++ b/main.go @@ -11,13 +11,15 @@ package main import ( "fmt" + "gitlab.com/elixxir/client/bindings" "gitlab.com/elixxir/xxdk-wasm/wasm" "os" "syscall/js" ) func main() { - fmt.Println("Go Web Assembly") + fmt.Println("Starting xxDK WebAssembly bindings.") + fmt.Printf("Client version %s\n", bindings.GetVersion()) // wasm/backup.go js.Global().Set("NewCmixFromBackup", js.FuncOf(wasm.NewCmixFromBackup)) diff --git a/test/assets/wasm_exec.js b/test/assets/wasm_exec.js index d723701ff7a37554fe78f9c400d7b90ccbb28a75..b378386281a5d1c72b292753b0779f79a8929251 100644 --- a/test/assets/wasm_exec.js +++ b/test/assets/wasm_exec.js @@ -503,7 +503,7 @@ }, // func Throw(exception string, message string) - 'gitlab.com/elixxir/client/wasm.Throw': (sp) => { + 'gitlab.com/elixxir/xxdk-wasm/wasm.Throw': (sp) => { const exception = loadString(sp + 8) const message = loadString(sp + 24) throw globalThis[exception](message) diff --git a/test/server/main.go b/test/server/main.go index d1f9722b6c16a3d13efc20e53678d82ec703731b..510ea0feaf8e21f5be3a4599c367fed5ef5de2fe 100644 --- a/test/server/main.go +++ b/test/server/main.go @@ -7,7 +7,7 @@ import ( func main() { port := "9090" - root := "test/assets" + root := "../assets" fmt.Printf("Starting server on port %s from %s\n", port, root) err := http.ListenAndServe(":"+port, http.FileServer(http.Dir(root)))