RouteManager is a small helper for client-side routing.
Export
routeManager
What it does
- keeps a map of routes and the currently active route
- navigates via
history.pushState - resolves dynamic routes using
URLPattern
Initialize and register routes
Register routes before callingloadRouteByCurrentUrl():
Navigation
history.pushState and handles browser back/forward through popstate.
To resolve a URL before navigating:
disable() to temporarily disable navigation. removeActiveRoute() clears the saved route from sessionStorage.