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

Fix for Web Workers #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix for Web Workers #37

wants to merge 1 commit into from

Conversation

marcrobledo
Copy link

fixes issues #12 and #35

It now detects the Web Worker scope properly and can be imported in a Web Worker with self.importScripts.

Note: The minified build has not been rebuilt!

// Global object
else if (typeof WorkerGlobalScope === "function" && self instanceof WorkerGlobalScope) {
// Web Worker scope
self.msgpack = msgpack;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense (or is it even possible) to let the name "msgpack" be configured in this case as well like for the browser below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since a web worker runs in a different execution thread and has no access to the window object.

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

Successfully merging this pull request may close these issues.

2 participants