-
Notifications
You must be signed in to change notification settings - Fork 146
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
Add Worker Loader #349
Add Worker Loader #349
Conversation
Trunk v0.17 has been released so we can release this gloo worker mode as well. |
Can you please also update the chnagelog? Also, I would like to keep the ability to build workers without using trunk. That is kept intact, right? I use it to build workers that are called from a JS (SvelteKit) application so that is pretty important to have |
This is done.
This pull request adds a Existing worker users can continue using the e.g: The markdown example create the following loader shim: importScripts("./example_markdown_worker.js");wasm_bindgen("./example_markdown_worker_bg.wasm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -22,7 +22,8 @@ fn main() { | |||
.flatten() | |||
.expect_throw("failed to query root element"); | |||
|
|||
let mut bridge = MarkdownWorker::spawner().spawn("/example_markdown_worker.js"); | |||
let mut bridge = | |||
MarkdownWorker::spawner().spawn_with_loader("/example_markdown_worker_loader.js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if trunk can set a build-time env so this path doesn't need to be hard coded
This pull request implements the loader shim mode that is coming in the next trunk version.
This mode no longer uses inline scripts to load workers.
Trunk is responsible to create a loader script to initialise the worker.