Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm examples and documentation update #3261

Closed
alvarolm opened this issue Oct 30, 2022 · 2 comments
Closed

wasm examples and documentation update #3261

alvarolm opened this issue Oct 30, 2022 · 2 comments
Labels
docs Documentation needed wasm WebAssembly

Comments

@alvarolm
Copy link

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:
image
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

@deadprogram deadprogram added the wasm WebAssembly label Oct 31, 2022
@deadprogram deadprogram added docs Documentation needed next-release Will be part of next release labels May 17, 2023
@deadprogram
Copy link
Member

Please see tinygo-org/tinygo-site#349 and tinygo-org/tinygo-site#352

I will close this issue on next release when these updates are published. Thank everyone!

@deadprogram
Copy link
Member

This is part of the v0.28 release so now closing. Thank you!

@deadprogram deadprogram removed the next-release Will be part of next release label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation needed wasm WebAssembly
Projects
None yet
Development

No branches or pull requests

2 participants