-
Notifications
You must be signed in to change notification settings - Fork 241
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
ReferenceError: window is not defined when using Workers #153
Comments
It's doing that because of the AMD wrapper so that it'd work with various dependency managers without any issues. Try using it with browserify as a quick fix |
I fixed it like this:
You could use |
A PR would be very much appreciated for this. |
#247) * Added waitFor method * fixed README.md code example for waitFor method * Closes #153 by using the current global scope instead of window * added getMaxListeners method and defaultMaxListeners property * added missing semicolons * added the ability for defaultMaxListeners to set default max listeners for previously created instances; added TypeScript typings; added documentation for getMaxListeners() & defaultMaxListeners; added documentation for emitter.listeners();
* Added waitFor method * fixed README.md code example for waitFor method * Closes #153 by using the current global scope instead of window * added EventEmitter2.once method; added internal resolveOptions helper; added internal toCancelablePromise helper; * reworked waitFor method to use shared internal helpers; updated README.md; updated typings; fixed listening cancellation bug in case of using generic EventTarget interface; * updated README.md; * updated README.md features section; * refactored toCancelablePromise to makeCancelablePromise; removed TODO; Co-authored-by: RangerMauve <RangerMauve@hotmail.com>
* Added waitFor method * fixed README.md code example for waitFor method * Closes #153 by using the current global scope instead of window * Added universal test loader for nodeunit and mocha test suites; Updated dependencies; Fixed coverage script; Reworked repo scripts set; Added coveralls integration; Added travis build integration; Updated README.md badges; * Extended integration with assert module; * Added prepublishOnly & postversion scripts * Reduced required branches coverage to 75% * added return value from test function just in case * allowed to skip null tests * updated package description * Added keywords
If I do this in web worker:
I get an error as in title. I thought this library was supposed to be compatible with node.js. So why use window? Actually, why does it execute anything on
window
when just being loaded? Shouldn't such calls be lazy?The text was updated successfully, but these errors were encountered: