UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

35 lines (34 loc) 1.06 kB
import { isWebClient } from "../constants"; import { getLinkingConfig as createLinkingConfig } from "./getLinkingConfig"; let linkingConfig; function getLinking() { return linkingConfig; } function setLinking(_) { linkingConfig = _; } function resetLinking() { linkingConfig = void 0; } function setupLinking(routeNode, initialLocation) { let initialState; if (routeNode && (linkingConfig = createLinkingConfig(routeNode), initialLocation)) { linkingConfig.getInitialURL = () => initialLocation.toString(); let path = initialLocation.pathname + (initialLocation.search || ""); if (isWebClient) { const historyState = window.history.state; historyState?.__tempLocation?.pathname && !historyState.__tempKey && (path = historyState.__tempLocation.pathname + (historyState.__tempLocation.search || "")); } initialState = linkingConfig.getStateFromPath?.(path, linkingConfig.config); } return initialState; } export { getLinking, resetLinking, setLinking, setupLinking }; //# sourceMappingURL=linkingConfig.js.map