UNPKG

react-view-router

Version:
46 lines (44 loc) 1.24 kB
var REACT_VIEW_ROUTER_KEY = '__REACT_VIEW_ROUTER_GLOBAL__'; /** @type {Window & typeof globalThis & { [RAINBOW_ROUTER_KEY]: RainbowRouterGlobal }} */ var _global = null; if (typeof globalThis === 'undefined') { if (typeof window !== 'undefined') { _global = window; // @ts-ignore window.globalThis = window; } if (typeof globalThis === 'undefined' && typeof global !== 'undefined') { // @ts-ignore global.globalThis = global; _global = global; } if (typeof globalThis === 'undefined' && typeof self !== 'undefined') { // @ts-ignore self.globalThis = self; _global = self; } if (typeof globalThis === 'undefined' && typeof this !== 'undefined') { // @ts-ignore this.globalThis = this; _global = self; } } else { _global = globalThis; } // @ts-ignore if (!_global[REACT_VIEW_ROUTER_KEY]) { Object.defineProperty(_global, REACT_VIEW_ROUTER_KEY, { value: { contexts: {}, historys: {} }, configurable: true }); } // @ts-ignore var REACT_VIEW_ROUTER_GLOBAL = _global[REACT_VIEW_ROUTER_KEY]; if (!REACT_VIEW_ROUTER_GLOBAL.contexts) { REACT_VIEW_ROUTER_GLOBAL.contexts = {}; } export { REACT_VIEW_ROUTER_GLOBAL }; //# sourceMappingURL=global.js.map