1 | export interface Delegate {
|
2 | contextEntered?(context: string, route: MatchDSL): void;
|
3 | willAddRoute?(context: string | undefined, route: string): string;
|
4 | }
|
5 | export declare type Opaque = {} | void | null | undefined;
|
6 | export interface Route {
|
7 | path: string;
|
8 | handler: Opaque;
|
9 | queryParams?: string[];
|
10 | }
|
11 | export interface RouteRecognizer {
|
12 | delegate: Delegate | undefined;
|
13 | add(routes: Route[]): void;
|
14 | }
|
15 | export interface MatchCallback {
|
16 | (match: MatchDSL): void;
|
17 | }
|
18 | export interface MatchDSL {
|
19 | (path: string): ToDSL;
|
20 | (path: string, callback: MatchCallback): void;
|
21 | }
|
22 | export interface ToDSL {
|
23 | to(name: string, callback?: MatchCallback): void;
|
24 | }
|
25 | export declare class Matcher {
|
26 | routes: {
|
27 | [path: string]: string | undefined;
|
28 | };
|
29 | children: {
|
30 | [path: string]: Matcher | undefined;
|
31 | };
|
32 | target: string | undefined;
|
33 | constructor(target?: string);
|
34 | add(path: string, target: string): void;
|
35 | addChild(path: string, target: string, callback: MatchCallback, delegate: Delegate | undefined): void;
|
36 | }
|
37 | export default function <T extends RouteRecognizer>(this: T, callback: MatchCallback, addRouteCallback?: (routeRecognizer: T, routes: Route[]) => void): void;
|