Merge pull request #434 from PatrickShaw/globalThis-add

Prefer globalThis over window and global
This commit is contained in:
Kevin Jahns 2022-06-15 12:04:09 +02:00 committed by GitHub
commit a5e0448a92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,10 +93,12 @@ export {
UpdateEncoderV1 UpdateEncoderV1
} from './internals.js' } from './internals.js'
const glo = /** @type {any} */ (typeof window !== 'undefined' const glo = /** @type {any} */ (typeof globalThis !== 'undefined'
? window ? globalThis
// @ts-ignore : typeof window !== 'undefined'
: typeof global !== 'undefined' ? global : {}) ? window
// @ts-ignore
: typeof global !== 'undefined' ? global : {})
const importIdentifier = '__ $YJS$ __' const importIdentifier = '__ $YJS$ __'