-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
prefer to use globalThis & fallback to this #976
base: master
Are you sure you want to change the base?
Conversation
@@ -28,7 +28,7 @@ License: MIT | |||
// in strict mode we cannot access arguments.callee, so we need a named reference to | |||
// stringify the factory method for the blob worker | |||
// eslint-disable-next-line func-name | |||
}(this, function moduleFactory() | |||
}(typeof globalThis !== 'undefined' ? globalThis : this, function moduleFactory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will prefer to avoid conditional variables. Can we just use globalThis
instead of this
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I added the conditional for backward compatability but according to the globalThis docs, all modern browsers in the current version support globalThis
.
It looks like internet explorer does not support globalThis
without a polyfill though.
https://caniuse.com/?search=globalThis
So if you are willing to drop IE without the polyfill support, then using only globalThis
would probably work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop IE without the polyfill (if anyone needs the IE support can implement the polyfill by themselves).
Could you please update the PR so I can merge them? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were having the same problem and this did the job, thank you! |
fixes #975