-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
44 lines (40 loc) · 1.33 KB
/
index.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
import Navigo, { Match, RouteHooks } from "navigo";
export type NotFoundRouteProps = {
children: any;
hooks?: RouteHooks;
};
export type NavigoSwitchContextType = {
isInSwitch: boolean;
switchMatch: false | Match;
};
export type Path = { path: string };
export type NavigoRouting = {
match: false | Match;
[key: string]: Any;
};
export type BlockingLifecycleFuncArgs = { render: Function; done: Function; match: Match };
export type NonBlockingLifecycleFuncArgs = { render: Function; match: Match };
export type BlockingLifecycleFunc = (arg: BlockingLifecycleFuncArgs) => void;
export type NonBlockingLifecycleFunc = (arg: NonBlockingLifecycleFuncArgs) => void;
export type RouteProps = {
path: string;
children?: any;
name?: string;
before?: BlockingLifecycleFunc;
after?: NonBlockingLifecycleFunc;
already?: NonBlockingLifecycleFunc;
leave?: BlockingLifecycleFunc;
};
// utils
export function configureRouter(root: string): Navigo;
export function reset(): void;
export function getRouter(): Navigo;
// components
export function Base(props: Path);
export function Route(props: RouteProps);
export function NotFound(props: NotFoundRouteProps);
export function Redirect(props: Path);
export function Switch(props: { children?: any });
// hooks
export function useNavigo(): NavigoRouting;
export function useLocation(): Match;