How do I get the `DedicatedWorkerGlobalScope`?
felipellrocha opened this issue · comments
Once I'm inside of a thread, how do I get that thread's DedicatedWorkerGlobalScope
?
You can use the global()
function of js_sys
to get the global object, and then dyn_into
that into a DedicatedWorkerGlobalScope
(see this issue discussing the problem). Note that, due to the way things are currently instrumented, you won't be able to post messages to the worker since the messaging API is already utilized by wasm_thread
. Some additional code would need to be added in this crate to allow for posting custom messages.