xuset / idb-kv-store

Persistent key-value store for web browsers backed by IndexedDB
MIT License
36 stars 11 forks source link

Use globalThis as global by default #29

Open jhiesey opened 3 years ago

jhiesey commented 3 years ago

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.