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

Take js object as parameter of a wasm function #9

Open
catethos opened this issue Nov 29, 2023 · 3 comments
Open

Take js object as parameter of a wasm function #9

catethos opened this issue Nov 29, 2023 · 3 comments
Labels
question Further information is requested

Comments

@catethos
Copy link

is there a way to write a webassembly function that takes arbitrary javascript object? Rust seem to provide a jsObject type for this purpose

@RoyalIcing
Copy link
Owner

How would you like to use this with JavaScript? Are you wanting to run it in the browser?

Rust WasmBindgen has an external stack of JavaScript objects, and then an integer index into that stack is passed within WebAssembly. They describe their approach as “shoehorning JS objects into a u32 for wasm to use”. https://rustwasm.github.io/wasm-bindgen/contributing/design/js-objects-in-rust.html

Currently Orb doesn’t generate any helper JavaScript but it may do in the future. If you can describe your use case this can inform that potential effort.

@catethos
Copy link
Author

I want to write more Elixir code but my current environment is not supporting it. So I am thinking compiling Elixir code into WASM and run it as some kind of micro service in the server side

@RoyalIcing
Copy link
Owner

What sort of Elixir code would you want to run — what tasks is it doing?

@RoyalIcing RoyalIcing added the question Further information is requested label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants