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

importScripts incorrectly reported #75

Closed
JakeChampion opened this issue Mar 22, 2015 · 2 comments

Comments

@JakeChampion
Copy link

commented Mar 22, 2015

// worker.js
importScripts('../../pouchdb.min.js')

If you run this file through standard, it returns

worker.js:2:0: 'importScripts' is not defined.

importScripts is a valid function in a worker context and as such, shouldn't error.

@JakeChampion

This comment has been minimized.

Copy link
Author

commented Mar 22, 2015

self is also another property that exists in workers that standard returns a false positive for.

@feross

This comment has been minimized.

Copy link
Member

commented Apr 2, 2015

This edge case is documented in the readme now: https://github.com/feross/standard#what-about-web-workers

The recommendation is to just add a comment to the top of your worker:

/* global self, importScripts */

@feross feross closed this Apr 2, 2015

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.