- ~141b minified and gzipped
- NO dependencies
const globalThis =
globalThisis a TC-39 proposal which is already supported by Firefox and Chrome.
- a ponyfill is a better polyfill that doesn't patch the environment.
There are existing ponyfills/polyfills out there, but they didn't work for me:
- mine is much simpler: a single TS file of 6 meaningful lines
- I needed TypeScript
About the proposed implementation here: https://mathiasbynens.be/notes/globalthis we can't use it: it creates a polyfill, not a ponyfill. However I took a line from the "naive implementation".