go: wasm: global functions from wasm not working from node
What version of Go are you using (go version
)?
$ go version go version go1.12beta2 Darwin/amd64
Does this issue reproduce with the latest release?
Yes
What did you do?
I am trying to call registered functions (aka callbacks) defined in the WebAssembly file from node js. I use the provided wasm_exec.js which does call into the main function without any issues. From what I could gather, we are missing a way to expose the registered functions in JS. But unfortunately I am not familiar enough with the implementation details nor did I find a lot of information online on the matter.
What did you expect to see?
I expected to be able to call my exposed functions from js outside of the browser.
What did you see instead?
A js exception
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (18 by maintainers)
The
go.run(result.instance);
is returning earlier than you expect. If you do this:then you get:
Instead, have your Go code call some JS global after it is done with setup.