Closed
Description
While trying to follow the guide:
https://tinygo.org/docs/guides/webassembly/
got a little confused since I couldn't figure out how to define an exported (js) function :
// This function is imported from JavaScript, as it doesn't define a body.
// You should define a function named 'main.add' in the WebAssembly 'env'
// module from JavaScript.
func add(x, y int) int
so decided to ask in slack:
https://gophers.slack.com/archives/CDJD3SUP6/p1666832165660899
thankfully @aykevl pointed out that this "method" (define an exported function) seems to be a deprecated, so the documentation needs an update tinygo-org/tinygo-site#305, this got me wondering:
what is the correct way to call an external js function from wasm, is it using syscall/js ?
some of the wasm examples https://github.com/tinygo-org/tinygo/tree/release/src/examples/wasm seem to be over 4 years old, may be a review of them is necessary ?
glad to help in any way