UNPKG

1.88 kBTypeScriptView Raw
1import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime';
2import { NavigationHookCallback } from './route-interface';
3export declare class Route implements ComponentInterface {
4 /**
5 * Relative path that needs to match in order for this route to apply.
6 *
7 * Accepts paths similar to expressjs so that you can define parameters
8 * in the url /foo/:bar where bar would be available in incoming props.
9 */
10 url: string;
11 /**
12 * Name of the component to load/select in the navigation outlet (`ion-tabs`, `ion-nav`)
13 * when the route matches.
14 *
15 * The value of this property is not always the tagname of the component to load,
16 * in `ion-tabs` it actually refers to the name of the `ion-tab` to select.
17 */
18 component: string;
19 /**
20 * A key value `{ 'red': true, 'blue': 'white'}` containing props that should be passed
21 * to the defined component when rendered.
22 */
23 componentProps?: {
24 [key: string]: any;
25 };
26 /**
27 * A navigation hook that is fired when the route tries to leave.
28 * Returning `true` allows the navigation to proceed, while returning
29 * `false` causes it to be cancelled. Returning a `NavigationHookOptions`
30 * object causes the router to redirect to the path specified.
31 */
32 beforeLeave?: NavigationHookCallback;
33 /**
34 * A navigation hook that is fired when the route tries to enter.
35 * Returning `true` allows the navigation to proceed, while returning
36 * `false` causes it to be cancelled. Returning a `NavigationHookOptions`
37 * object causes the router to redirect to the path specified.
38 */
39 beforeEnter?: NavigationHookCallback;
40 /**
41 * Used internally by `ion-router` to know when this route did change.
42 */
43 ionRouteDataChanged: EventEmitter<any>;
44 onUpdate(newValue: any): void;
45 onComponentProps(newValue: any, oldValue: any): void;
46 connectedCallback(): void;
47}