Skip to content

Conversation

@Seb-C
Copy link

@Seb-C Seb-C commented Sep 30, 2013

The window object doesn't exists in webworkers, self must be used instead.

The window object doesn't exists in webworkers, self must be used instead.
base64.js Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

s/exists/exist/

@davidchambers
Copy link
Owner

Inferring the environment is an increasingly challenging issue in JavaScript projects. :\

This change seems fine to me, but I'd like to get an "LGTM" from @michaelficarra before merging it.

@michaelficarra
Copy link
Collaborator

@sebcap26: In a WebWorker environment, what is the result of (function(){ return this === self; }())?

@Seb-C
Copy link
Author

Seb-C commented Oct 1, 2013

It seems that "this" can also be used instead of "self" in a WebWorker.

Debugging WebWorkers is hard, so I had to do that in my webworker :

throw new Error("test : " + (self === this));

The error message in console is "test : true".

But the w3c specs refers to "self" : http://www.w3.org/TR/workers/#the-workerglobalscope-common-interface

@michaelficarra
Copy link
Collaborator

Then just changing window to this should be sufficient.

@davidchambers
Copy link
Owner

Then just changing window to this should be sufficient.

Very nice. Mind updating the pull request, @sebcap26?

@Seb-C
Copy link
Author

Seb-C commented Oct 2, 2013

Should I also update the minified version ? I'm not sure to have the required dependencies to "make" it :/

@davidchambers
Copy link
Owner

Try the following commands:

$ make setup
$ make test
$ make base64.min.js
$ git commit --all --amend

@Seb-C
Copy link
Author

Seb-C commented Oct 3, 2013

Error on setup :

ERR! Error: No compatible version found: source-map@'>=0.1.7- <0.2.0-'

@davidchambers
Copy link
Owner

ERR! Error: No compatible version found: source-map@'>=0.1.7- <0.2.0-'

I don't know what was going on there (works for me). I made the change and pushed to master. I'll publish a new version now.

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.

3 participants