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

prefer to use globalThis & fallback to this #976

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

Conversation

btakita
Copy link

@btakita btakita commented Mar 1, 2023

fixes #975

@@ -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()
Copy link
Collaborator

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 ?

Copy link
Author

@btakita btakita Mar 1, 2023

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.

Copy link
Collaborator

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

@CrunchylnMilk
Copy link

We were having the same problem and this did the job, thank you!

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.

error Cannot set properties of undefined (setting 'Papa')
3 participants