fantasy-land
fantasy-land copied to clipboard
Improve portability of the UMD build
This PR:
- replaces
self
withglobalThis
- makes detection of CommonJS environments more robust
globalThis
is the official way to refer to the global scope and is supported by almost all environments:
engine | self | globalThis |
---|---|---|
Node.js | ✖ | ✔ |
QuickJS | ✖ | ✔ |
SpiderMonkey | ✖ | ✔ |
Modern browsers | ✔ | ✔ |
Deno | ✔ | ✔ |
IE11 | ✔ | ✖ |
The notable exception is IE11, which will need to use a polyfill. If IE11 support was previously promised or assumed, then this would be a breaking change.
Thanks for the pull request, @chocolateboy! I pushed a few tweaks to your branch. Are you happy with them?
Yes, LGTM, thanks!