forked from emeryberger/CSrankings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigo.d.ts
47 lines (33 loc) · 1.55 KB
/
navigo.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Type definitions for navigo 4.0
// Project: https://github.com/krasimir/navigo
// Definitions by: Adrian Ehrsam <https://github.com/aersamkull>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface NavigoHooks {
before?(done: (suppress?: boolean) => void): void;
after?(): void;
}
type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses(parametersObj: any): void };
declare class Navigo {
/**
* Constructs the router
* @param root The main URL of your application.
* @param useHash If useHash set to true then the router uses an old routing approach with hash in the URL. Navigo anyways falls back to this mode if there is no History API supported.
*/
constructor(root?: string | null, useHash?: boolean);
on(location: string, handler: RouteHandler, hooks?: NavigoHooks): Navigo;
on(location: RegExp, handler: (...parameters: string[]) => void, hooks?: NavigoHooks): Navigo;
on(routes: { [key: string]: RouteHandler }): Navigo;
on(rootHandler: RouteHandler, hooks?: NavigoHooks): Navigo;
notFound(handler: ((query: string) => void), hooks?: NavigoHooks): void;
navigate(path: string, absolute?: boolean): void;
updatePageLinks(): void;
generate(path: string, params?: any): string;
resolve(currentURL?: string): boolean;
link(path: string): string;
disableIfAPINotAvailable(): void;
pause(): void;
resume(): void;
destroy(): void;
}
export = Navigo;
export as namespace Navigo;