UNPKG

957 BTypeScriptView Raw
1declare namespace imba {
2
3 /**
4 * @custom
5 */
6 interface Router {
7
8 /**
9 * The currently matching path
10 */
11 path: string;
12 /**
13 * The hash
14 */
15 hash: string;
16 url: URL;
17 pathname: string;
18
19 refresh(): void;
20
21 alias(from: string, to: string): void;
22 /**
23 * See if router currently matches a pattern/path
24 */
25 match(pattern: string | RegExp): null | any;
26
27 /**
28 * Go to a url
29 * @param url
30 * @param state
31 */
32 go(url: string, state?: object): void;
33 /**
34 * Switch to another url without pushing to the history
35 * @param url
36 * @param state
37 */
38 replace(url: string, state?: object): void;
39
40 on(event:string,callback:Function);
41 }
42
43 /**
44 * Reference to global router
45 */
46 let router: Router;
47}
\No newline at end of file