Skip to content
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

How do I get the DedicatedWorkerGlobalScope? #7

Closed
felipellrocha opened this issue Jun 17, 2022 · 2 comments
Closed

How do I get the DedicatedWorkerGlobalScope? #7

felipellrocha opened this issue Jun 17, 2022 · 2 comments

Comments

@felipellrocha
Copy link

Once I'm inside of a thread, how do I get that thread's DedicatedWorkerGlobalScope?

@DouglasDwyer
Copy link
Contributor

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.

@chemicstry
Copy link
Owner

Closing this, because it's a problem with web_sys. Posting messages to workers is tracked in #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants