UNPKG

@wener/console

Version:
16 lines (15 loc) 679 B
import { getGlobalStates, setGlobalStates } from "@wener/utils"; import { ConsoleEventType, getConsoleEmitter } from "../console/ConsoleEmitter.js"; export function getBaseUrl() { return getGlobalStates("SiteBaseUrl", function () { var _globalThis_location; return ((_globalThis_location = globalThis.location) === null || _globalThis_location === void 0 ? void 0 : _globalThis_location.origin) || "http://localhost"; }); } export function setBaseUrl(baseUrl) { setGlobalStates("SiteBaseUrl", baseUrl); getConsoleEmitter().emit(ConsoleEventType.BaseUrlChanged, { baseUrl: baseUrl }); console.log("setBaseUrl: ".concat(baseUrl)); }