-
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
Complete gloo-worker webassembly example running in a browser #439
Comments
Using @jin-eld example is the only way I have found to make the gloo worker work. However, it's really different from the simple example found in the documentation, for instance here: https://docs.rs/gloo-worker/latest/gloo_worker/oneshot/index.html Am I doing something wrong? |
The gloo examples are to be used with trunk, which is the defacto build tool for rust/wasm frontend frameworks. The index.html is read by trunk. I think we should clarify that, perhaps even add a readme for examples. Would you mind creating such a PR? |
Hi,
I don't know if I was missing the obvious, but from the documentation and examples alone I was not immediately able to figure out how to actually put all the bits and pieces together in order to get a working setup of a main application that is being loaded via
index.html
and which then spawns a worker via Rust and communicates with it.The part that kept confusing me most was, that for instance in the
prime
example the worker code seemed to reside in the same source file as the function that spawns it and it took me a while to figure out, that the function marked as#[reactor]
apparently needs to be shared between both the code that does the spawning and the code that is representing the worker.Further, I was and actually still am totally confused about the interaction of the buttons in the
prime
example html and the Rust code, my targeted use case was anyway much simpler. In the end I was able to get something working that provided the setup that I needed: https://github.com/jin-eld/gloo-worker-exampleCan't say if I implemented everything in a way it was meant to be used from the gloo API perspective, I am also new to Rust, but it works; comments on that are welcome. Please let me know f you are interested in the above example, if yes, then I'd be willing to implement it in a pull request, otherwise I'll just leave the repo around in case someone else has a hard time to get started.
The text was updated successfully, but these errors were encountered: