stdweb
stdweb copied to clipboard
How to use with web workers?
I would like to execute everything in a web worker, but I couldn't find any docs about that.
after poking around a bit I am not seeing anything related to web workers in src
, but it's something you (or somebody else) could look at adding? you could maybe start by looking at src/webcore/promise.rs
as an example and implement a Worker
struct with methods that match the web worker spec.
Well, if you want to execute everything in a web worker you could just write a little JS code in your .html
file and call new Worker("your-module.js")
instead of including your module with a <script>
, however there are currently no bindings for the web workers APIs so you'd have to use the js!
macro from the inside of your module to actually communicate with the main thread. (Which shouldn't be a big deal since you can pass almost anything through the js!
macro.)