@segment/analytics-core
Version:
This package represents core 'shared' functionality that is shared by analytics packages. This is not designed to be used directly, but internal to analytics-node and analytics-browser.
18 lines (17 loc) • 385 B
text/typescript
/* eslint-disable no-restricted-globals */
// This an imperfect polyfill for globalThis
export const getGlobal = () => {
if (typeof globalThis !== 'undefined') {
return globalThis
}
if (typeof self !== 'undefined') {
return self
}
if (typeof window !== 'undefined') {
return window
}
if (typeof global !== 'undefined') {
return global
}
return null
}