@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
14 lines (13 loc) • 401 B
JavaScript
import { getRoute } from "./getRoute.js";
import { routerOptions } from "./routerDefineOptions.js";
export function Navigate(path) {
const prefixOptions = routerOptions.prefix || "";
if (prefixOptions) {
path = [
prefixOptions,
path
].join("/").replace(/\/+$/, "").replace(/\/{2,}/g, "/");
}
history.pushState(null, "", path);
getRoute();
}