Skip to content

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