native-spa-route
Version:
provide SPA route's experience with native web component
17 lines (16 loc) • 970 B
TypeScript
export declare function hook_a_link(): void;
type historyLifecycle = {
before?: (type: 'pushState' | 'replaceState' | 'back' | 'forward' | 'go', data: any, unused: string, url?: string | URL | null | undefined) => void;
after?: (type: 'pushState' | 'replaceState' | 'back' | 'forward' | 'go', data: any, unused: string, url?: string | URL | null | undefined) => void;
url_adapter?: (url: string | URL | null | undefined) => string;
};
export declare function hook_history_change(lifecycle?: historyLifecycle): void;
export type HistoryChangeEvent = CustomEvent<{
data: any;
unused: string;
url?: string | URL | null | undefined;
}>;
export declare function hook_route_change(callback: (e: HistoryChangeEvent) => void): void;
export declare function unhook_route_change(callback: (e: HistoryChangeEvent) => void): void;
export declare function redirect(from: string | URL | null | undefined, to: string | URL | null | undefined): void;
export {};