mirror of
https://github.com/danbulant/jose
synced 2026-05-24 20:41:46 +00:00
fix: handle globalThis undefined in legacy browsers
This commit is contained in:
parent
ff98da6fe1
commit
b83c59bb43
1 changed files with 2 additions and 1 deletions
|
|
@ -1,9 +1,10 @@
|
|||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
function getGlobal() {
|
||||
if (typeof globalThis !== 'undefined') return globalThis
|
||||
if (typeof self !== 'undefined') return self
|
||||
if (typeof window !== 'undefined') return window
|
||||
throw new Error('unable to locate global object')
|
||||
}
|
||||
|
||||
export default globalThis || getGlobal()
|
||||
export default getGlobal()
|
||||
|
|
|
|||
Loading…
Reference in a new issue