Even though this module isn't going to work in a node environment, it is inconvenient that importing it throws since neither window nor self is defined.
The solution is to use the new standard global globalThis if available, which should be defined in all new environments. If it's not available, fall back to the previous behavior.
Even though this module isn't going to work in a node environment, it is inconvenient that importing it throws since neither
window
norself
is defined.The solution is to use the new standard global
globalThis
if available, which should be defined in all new environments. If it's not available, fall back to the previous behavior.