@lifaon/rx-js-light
Version:
Blazing fast Observables
19 lines (18 loc) • 414 B
JavaScript
let GLOBAL_THIS;
export function inferGlobalThis() {
Object.defineProperty(Object.prototype, '__magic__', {
get: function () {
return this;
},
configurable: true
});
const globalThis = __magic__;
delete Object.prototype['__magic__'];
return globalThis;
}
export function getGlobalThis() {
if (GLOBAL_THIS === void 0) {
GLOBAL_THIS = inferGlobalThis();
}
return GLOBAL_THIS;
}