one
Version:
One is a new React Framework that makes Vite serve both native and web.
26 lines (25 loc) • 721 B
JavaScript
import { getPathFromState } from "../fork/getPathFromState.mjs";
import { getStateFromPath } from "../fork/getStateFromPath.mjs";
function getInitialURL() {
if (typeof window === "undefined") {
return "";
}
return window.location?.href || "";
}
function getRootURL() {
return "/";
}
function addEventListener(listener) {
if (typeof window === "undefined") {
return () => {};
}
const callback = () => {
listener(window.location.href);
};
window.addEventListener("popstate", callback);
return () => {
window.removeEventListener("popstate", callback);
};
}
export { addEventListener, getInitialURL, getPathFromState, getRootURL, getStateFromPath };
//# sourceMappingURL=linking.mjs.map