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

Change window To self #528

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

Conversation

Hossein-Fasihi
Copy link

Because when using window only web pages can use this. But when using self, then web workers can use it too.

What's The Use?

I encountered this when I was trying to use the resumable file upload inside a web worker (I had to, because I needed some synchronous, blocking, pre-processing on the file) then all the window.* methods would blow up. Such scenario doesn't seem very improbable, considering the nature of files & IO.

Backwards Compatible?

The "resumable.js" uses window.setTimeout in multiple cases and also window.resumable = resumable at the end of the file. As a matter of fact all these cases can be safely changed to self.* (look here). I changed it and it seems to work both on web pages & web workers too.

Because when using `window` only web pages can use this. But when using `self`, then web workers can use it too.
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.

1 participant