UNPKG

@wroud/navigation

Version:

A flexible, pattern-matching navigation system for JavaScript applications with built-in routing, browser integration, and navigation state management

54 lines 1.76 kB
import type { INavigation } from "./INavigation.js"; import type { IRouteMatcher, RouteMatcherState } from "./IRouteMatcher.js"; import type { IRouter } from "./IRouter.js"; import { type NavigationListener } from "./NavigationListener.js"; export declare class Navigation<TMatcher extends IRouteMatcher = IRouteMatcher> implements INavigation<TMatcher> { get state(): RouteMatcherState<TMatcher> | null; get history(): RouteMatcherState<TMatcher>[]; get position(): number; private innerState; private readonly listeners; readonly router: IRouter<TMatcher>; constructor(router?: IRouter<TMatcher>); /** * Get the current navigation state */ getState(): RouteMatcherState<TMatcher> | null; /** * Set the navigation state and position */ setState(position: number, state?: RouteMatcherState<TMatcher>[]): void; /** * Replace the current state with a new one */ replace(state: RouteMatcherState<TMatcher> | null): Promise<void>; /** * Navigate to a new state */ navigate(state: RouteMatcherState<TMatcher> | null): Promise<void>; /** * Navigate back to the previous state */ goBack(): Promise<void>; /** * Add a navigation listener */ addListener(listener: NavigationListener): () => void; /** * Remove a navigation listener */ removeListener(listener: NavigationListener): void; /** * Notify all listeners of a navigation event */ private notifyListeners; /** * Check if we can deactivate from the current route */ private canDeactivate; /** * Check if we can activate the target route */ private canActivate; } //# sourceMappingURL=Navigation.d.ts.map