installNavigationPath function

Module @runic-artifex/views in @runic-artifex/views 0.23.0

function installNavigationPath(options?: NavigationPathOptions): () => void;

Keeps the URL's fragment and the browser's history in step with the window's route path (navigation-path/1): - A change of the path region pushes a history entry, goes back to the previous one, or replaces the current one. Each entry keeps its index and path in history.state, so a reload keeps them. - The browser's Back and Forward and an edited address bar open the URL's route path with openNavigationPath, through the departure guards. Going back to an entry without a route path, such as a home page without a route, sends the window's Back instead. When the request doesn't commit, the URL goes back to the window's path: the history moves back to the entry that shows it, or the current entry is replaced. Only the latest of several quick moves reverts. - A URL with a route path when the page loads opens it, as a deep link, once the window reports its path. A reconnect of the same page shows the window's path instead. Install it once per page. The browser's own Back then goes through the history, so on CS-WebUI the Back button, the mouse's Back button and Alt+Left all work, and installBackNavigation goes back in the history too. Don't install it next to another router that owns the fragment, such as SvelteKit's hash router. Returns a function that stops it.