root.js 650 Bytes
Newer Older
徐立's avatar
徐立 committed
1
/* global globalThis, self */
2
import freeGlobal from './freeGlobal.js';
徐立's avatar
徐立 committed
3 4 5

/** Detect free variable `globalThis` */
/** 检测自由变量' globalThis ' */
6 7 8 9 10
const freeGlobalThis =
	typeof globalThis === 'object' &&
	globalThis !== null &&
	globalThis.Object == Object &&
	globalThis;
徐立's avatar
徐立 committed
11 12 13

/** Detect free variable `self`. */
/** 检测自由变量“自我”。 */
14
const freeSelf = typeof self === 'object' && self !== null && self.Object === Object && self;
徐立's avatar
徐立 committed
15 16 17

/** Used as a reference to the global object. */
/** 用作对全局对象的引用。 */
18
const root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')();
徐立's avatar
徐立 committed
19

20
export default root;