UNPKG

respond-framework

Version:
16 lines (15 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isTest = exports.isServer = exports.isProd = exports.isNative = exports.isDev = exports.isClient = exports.hasSessionStorage = exports.hasLocalStorage = exports.hasHistory = exports.defaultOrigin = void 0; const defaultOrigin = exports.defaultOrigin = (typeof window !== 'undefined' && window.location?.origin) ?? 'http://localhost:3000'; const isProd = exports.isProd = process.env.NODE_ENV === 'production'; const isDev = exports.isDev = !isProd; const isTest = exports.isTest = process.env.NODE_ENV === 'test'; const isServer = exports.isServer = typeof window === 'undefined' && !isTest; const isClient = exports.isClient = !isServer; const isNative = exports.isNative = isClient && !isTest && !(typeof document !== 'undefined' && document.querySelector); const hasHistory = exports.hasHistory = !(isTest || isNative) && typeof history !== 'undefined' && history.pushState; const hasLocalStorage = exports.hasLocalStorage = typeof localStorage !== 'undefined'; const hasSessionStorage = exports.hasSessionStorage = typeof sessionStorage !== 'undefined';