rvx
Version:
A signal based rendering library
30 lines (29 loc) • 892 B
TypeScript
import { Query, QueryInit } from "./query.js";
import { Router } from "./router.js";
export interface HashRouterOptions {
/**
* The current location is parsed when one of these events occur.
*
* @default ["hashchange"]
*/
parseEvents?: string[];
}
/**
* A router that uses `location.hash` as the path ignoring the leading `"#"`.
*
* Everything after the first `"?"` is treated as query parameters.
*/
export declare class HashRouter implements Router {
#private;
constructor(options?: HashRouterOptions);
/**
* Called to parse & update this router's state from the current browser location.
*/
parse(): void;
get root(): Router;
get parent(): Router | undefined;
get path(): string;
get query(): Query | undefined;
push(path: string, query?: QueryInit): void;
replace(path: string, query?: QueryInit): void;
}