You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
535 B
16 lines
535 B
5 years ago
|
module.exports = (function () {
|
||
|
if (this) return this;
|
||
|
|
||
|
// Unexpected strict mode (may happen if e.g. bundled into ESM module) be nice
|
||
|
|
||
|
// Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
|
||
|
// In all ES5 engines global object inherits from Object.prototype
|
||
|
// (if you approached one that doesn't please report)
|
||
|
Object.defineProperty(Object.prototype, "__global__", {
|
||
|
get: function () { return this; },
|
||
|
configurable: true
|
||
|
});
|
||
|
try { return __global__; }
|
||
|
finally { delete Object.prototype.__global__; }
|
||
|
})();
|