globalThis ponyfill
This is a trivial TypeScript-compatible globalThis
ponyfill.
- very small minzipped size
- NO dependencies
- doesn't alter the environment (ponyfill)
- compatible with node & browser
Usage
import { getGlobalThis } from '@offirmo/globalthis-ponyfill'
const globalThis = getGlobalThis()
Rationale
Credits
YES I had a look at ljharb/globalThis 's implementation (MIT)
and started my implementation from it! Thanks a lot and all credits due!
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".