1 | export declare type Path = string | RegExp | Array<string | RegExp>;
|
2 | export interface ActiveRouter {
|
3 | subscribe: (location: LocationSegments, nextListeners: RouteSubscription[], routeSubscription: RouteSubscription) => Listener;
|
4 | dispatch: (location: LocationSegments, nextListeners: RouteSubscription[]) => void;
|
5 | }
|
6 | export declare type Prompt = (location: LocationSegments, action: string) => string;
|
7 | export interface RouteRenderProps {
|
8 | history: RouterHistory;
|
9 | match: MatchResults;
|
10 | [key: string]: any;
|
11 | }
|
12 | export interface RouteViewOptions {
|
13 | scrollTopOffset?: number;
|
14 | scrollToId?: string;
|
15 | }
|
16 | export interface RouteSubscription {
|
17 | isMatch: boolean;
|
18 | groupId?: string;
|
19 | groupIndex?: number;
|
20 | }
|
21 | export declare type HistoryType = 'browser' | 'hash';
|
22 | export declare type Listener = () => void;
|
23 | export interface LocationSegments {
|
24 | pathname: string;
|
25 | query: {
|
26 | [key: string]: any;
|
27 | };
|
28 | key: string;
|
29 | scrollPosition?: [number, number];
|
30 | search?: string;
|
31 | hash?: string;
|
32 | state?: any;
|
33 | }
|
34 | export declare type LocationSegmentPart = 'pathname' | 'search' | 'hash' | 'state' | 'key';
|
35 | export interface RouterHistory {
|
36 | length: number;
|
37 | action: string;
|
38 | location: LocationSegments;
|
39 | createHref: (location: LocationSegments) => string;
|
40 | push: (path: string | LocationSegments, state?: any) => void;
|
41 | replace: (path: string | LocationSegments, state?: any) => void;
|
42 | go: (n: number) => void;
|
43 | goBack: () => void;
|
44 | goForward: () => void;
|
45 | block: (prompt?: string | Prompt) => () => void;
|
46 | listen: (listener: Function) => () => void;
|
47 | win: Window;
|
48 | }
|
49 | export interface RouterGroup {
|
50 | listenerList: ((switchMatched: boolean) => null | MatchResults)[];
|
51 | groupedListener: () => void;
|
52 | startLength: number;
|
53 | }
|
54 | export interface MatchOptions {
|
55 | path?: Path;
|
56 | exact?: boolean;
|
57 | strict?: boolean;
|
58 | }
|
59 | export interface MatchResults {
|
60 | path: string;
|
61 | url: string;
|
62 | isExact: boolean;
|
63 | params: {
|
64 | [key: string]: string;
|
65 | };
|
66 | }
|