Call init() in module_name.js for web target #2989
sk8ersteve
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think it would be simpler to call "await init()" and export wasm.memory from out_dir/module_name.js instead of exporting this init function and leaving it to the user to call init() for access to memory from their js.
Current:
Generated js footer:
Code to use it:
Proposed:
Generated js footer:
Code to use it:
It's also a possibility to move the current generated js to the _bg.js file and put these 3 new proposed lines in its own js file similar to what is done for the nodejs target. Is there any reason we wouldn't prefer this approach? I have already made the necessary changes to wasm-bindgen in a local clone of the repo and tested it. I'm just looking for any feedback on if this is a good change or not before I go forward and create a pull request.
Beta Was this translation helpful? Give feedback.
All reactions