UNPKG

699 BJavaScriptView Raw
1"use strict";
2
3// eslint-disable-next-line func-names
4module.exports = function () {
5 if (typeof globalThis === "object") {
6 return globalThis;
7 }
8
9 var g;
10
11 try {
12 // This works if eval is allowed (see CSP)
13 // eslint-disable-next-line no-new-func
14 g = this || new Function("return this")();
15 } catch (e) {
16 // This works if the window reference is available
17 if (typeof window === "object") {
18 return window;
19 } // This works if the self reference is available
20
21
22 if (typeof self === "object") {
23 return self;
24 } // This works if the global reference is available
25
26
27 if (typeof global !== "undefined") {
28 return global;
29 }
30 }
31
32 return g;
33}();
\No newline at end of file