feat(demo): Run js in worker in wat2wasm demo#2568
feat(demo): Run js in worker in wat2wasm demo#2568spotandjake wants to merge 2 commits intoWebAssembly:mainfrom
Conversation
91a8e44 to
b67fde0
Compare
|
Hope I'm not bugging anyone, but any chance I could get a review on this? |
sbc100
left a comment
There was a problem hiding this comment.
Fair enough!
Seems like it might be overkill for a simple demo but if you find it useful to be able to avoid blocking the main page then lgtm.
Its been while since we changed this I think.. do you know how we publish the new version? Is it automatic?
b67fde0 to
40913ce
Compare
I know that this is just a demo however I know myself and others in the wasm community sometimes use this tooling to explore the spec and play around hands on with wasm in a convient and quick manner. I wasn't around the last time this was updated and can't find any specific workflows for it however I did notice that github pages seems to run on every commit to main logs here so it seems like this should just get updated. Seperatly though this is probably best discussed in another issue it might make sense to run Thankyou for the review. |
This pr moves execution of the user js and wasm module from the main page to a web worker. The benefit of this is if you write an infinite loop in either the js or wasm you won't crash the main page and can recompile. I also added a
Runbutton as I noticed there wasn't one and it was useful for testing (when you edit the wasm the output doesn't update until you click run or edit the js).NOTE
As the js is now running in a worker it is isolated so while before you could have worked with the dom from the js editor you can't really do this anymore. I feel like the old behaviour didn't make much sense anyways though.