UNPKG

infinity-forge

Version:
71 lines 1.89 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ssrWindow = void 0; exports.getWindow = getWindow; var extend_1 = __importDefault(require("./extend.js")); var document_1 = require("./document.js"); var ssrWindow = { document: document_1.ssrDocument, navigator: { userAgent: '', }, location: { hash: '', host: '', hostname: '', href: '', origin: '', pathname: '', protocol: '', search: '', }, history: { replaceState: function () { }, pushState: function () { }, go: function () { }, back: function () { }, }, CustomEvent: function CustomEvent() { return this; }, addEventListener: function () { }, removeEventListener: function () { }, getComputedStyle: function () { return { getPropertyValue: function () { return ''; }, }; }, Image: function () { }, Date: function () { }, screen: {}, setTimeout: function () { }, clearTimeout: function () { }, matchMedia: function () { return {}; }, requestAnimationFrame: function (callback) { if (typeof setTimeout === 'undefined') { callback(); return null; } return setTimeout(callback, 0); }, cancelAnimationFrame: function (id) { if (typeof setTimeout === 'undefined') { return; } clearTimeout(id); }, }; exports.ssrWindow = ssrWindow; function getWindow() { var win = typeof window !== 'undefined' ? window : {}; (0, extend_1.default)(win, ssrWindow); return win; } //# sourceMappingURL=window.js.map