@beenotung/tslib
Version:
utils library in Typescript
28 lines • 808 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWindowOrGlobal = exports.getGlobal = exports.getWindow = void 0;
function getWindow() {
if (typeof window === 'undefined') {
throw new Error('Not running in Window runtime');
}
return window;
}
exports.getWindow = getWindow;
function getGlobal() {
if (typeof global === 'undefined') {
throw new Error('Not running in NodeJS runtime');
}
return global;
}
exports.getGlobal = getGlobal;
function getWindowOrGlobal() {
if (typeof global !== 'undefined') {
return global;
}
if (typeof window !== 'undefined') {
return window;
}
throw new Error('unknown runtime');
}
exports.getWindowOrGlobal = getWindowOrGlobal;
//# sourceMappingURL=runtime.js.map