UNPKG

@beenotung/tslib

Version:
27 lines (26 loc) 697 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getWindow = getWindow; exports.getGlobal = getGlobal; exports.getWindowOrGlobal = getWindowOrGlobal; function getWindow() { if (typeof window === 'undefined') { throw new Error('Not running in Window runtime'); } return window; } function getGlobal() { if (typeof global === 'undefined') { throw new Error('Not running in NodeJS runtime'); } return global; } function getWindowOrGlobal() { if (typeof global !== 'undefined') { return global; } if (typeof window !== 'undefined') { return window; } throw new Error('unknown runtime'); }