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

Use es5-ext/global as a more robust way to resolve browser's window object (global this) #362

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

michaelsbradleyjr
Copy link
Contributor

@michaelsbradleyjr michaelsbradleyjr commented Jul 28, 2019

Related to #360.

The es5-ext/global module is based on Mathias Bynens' polyfill for globalThis. It uses the same robust technique but is more conservative in that it does not add a globalThis property to the resolved object, i.e. window in a browser and global in Node. It also lacks the "old IE" fallback seen in a demo of the original polyfill, but that is easily provided in this commit.

@michaelsbradleyjr michaelsbradleyjr changed the title Polyfill globalThis as a more robust way to resolve a browser's window object Use es5-ext/global as a more robust way to resolve browser's window Jul 29, 2019
@michaelsbradleyjr
Copy link
Contributor Author

michaelsbradleyjr commented Jul 29, 2019

I updated this PR and its description after realizing the more conservative approach of the es5-ext/global module is probably better.

@michaelsbradleyjr michaelsbradleyjr changed the title Use es5-ext/global as a more robust way to resolve browser's window Use es5-ext/global as a more robust way to resolve browser's window object (global this) Jul 29, 2019
The [es5-ext/global][es5g] module is based on Mathias Bynens' [polyfill][poly]
for [`globalThis`][gT]. It uses the same robust technique but is more
conservative in that it does not add a `globalThis` property to the resolved
object, i.e. `window` in a browser and `global` in Node. It also lacks the "old
IE" fallback seen in a [demo][demo] of the original polyfill, but that is
easily provided in this commit.

[es5g]: https://github.com/medikoo/es5-ext/blob/master/global.js
[poly]: https://mathiasbynens.be/notes/globalthis
[gT]: https://github.com/tc39/proposal-global
[demo]: https://mathiasbynens.be/demo/globalthis-ie
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.

2 participants