1 | import { CommandRegistry } from '@lumino/commands';
|
2 | import { Token } from '@lumino/coreutils';
|
3 | import { IDisposable } from '@lumino/disposable';
|
4 | import { ISignal } from '@lumino/signaling';
|
5 | import { IRouter } from './tokens';
|
6 |
|
7 |
|
8 |
|
9 | export declare class Router implements IRouter {
|
10 | |
11 |
|
12 |
|
13 | constructor(options: Router.IOptions);
|
14 | /**
|
15 | * The base URL for the router.
|
16 | */
|
17 | readonly base: string;
|
18 | /**
|
19 | * The command registry used by the router.
|
20 | */
|
21 | readonly commands: CommandRegistry;
|
22 | /**
|
23 | * Returns the parsed current URL of the application.
|
24 | */
|
25 | get current(): IRouter.ILocation;
|
26 | /**
|
27 | * A signal emitted when the router routes a route.
|
28 | */
|
29 | get routed(): ISignal<this, IRouter.ILocation>;
|
30 | /**
|
31 | * If a matching rule's command resolves with the `stop` token during routing,
|
32 | * no further matches will execute.
|
33 | */
|
34 | readonly stop: Token<void>;
|
35 | /**
|
36 | * Navigate to a new path within the application.
|
37 | *
|
38 | * @param path - The new path or empty string if redirecting to root.
|
39 | *
|
40 | * @param options - The navigation options.
|
41 | */
|
42 | navigate(path: string, options?: IRouter.INavOptions): void;
|
43 | /**
|
44 | * Register to route a path pattern to a command.
|
45 | *
|
46 | * @param options - The route registration options.
|
47 | *
|
48 | * @returns A disposable that removes the registered rule from the router.
|
49 | */
|
50 | register(options: IRouter.IRegisterOptions): IDisposable;
|
51 | /**
|
52 | * Cause a hard reload of the document.
|
53 | */
|
54 | reload(): void;
|
55 | /**
|
56 | * Route a specific path to an action.
|
57 | *
|
58 | * #### Notes
|
59 | * If a pattern is matched, its command will be invoked with arguments that
|
60 | * match the `IRouter.ILocation` interface.
|
61 | */
|
62 | route(): Promise<void>;
|
63 | private _routed;
|
64 | private _rules;
|
65 | }
|
66 | /**
|
67 | * A namespace for `Router` class statics.
|
68 | */
|
69 | export declare namespace Router {
|
70 | |
71 |
|
72 |
|
73 | interface IOptions {
|
74 | |
75 |
|
76 |
|
77 | base: string;
|
78 | |
79 |
|
80 |
|
81 | commands: CommandRegistry;
|
82 | }
|
83 | }
|