• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Route jump.
18 * @since 7
19 */
20declare enum NavigationType {
21  /**
22   * Jump to the next page.
23   * @since 7
24   */
25  Push,
26
27  /**
28   * Return to the previous page.
29   * @since 7
30   */
31  Back,
32
33  /**
34   * Replace page.
35   * @since 7
36   */
37  Replace,
38}
39
40/**
41 * Create route
42 * @since 7
43 */
44interface NavigatorInterface {
45  /**
46   * Called when the route jumps.
47   * @since 7
48   */
49  (value?: { target: string; type?: NavigationType }): NavigatorAttribute;
50
51  /**
52   * Called when using the navigator.
53   * @since 7
54   */
55  (): NavigatorAttribute;
56}
57
58/**
59 * Declare navigator properties.
60 * @since 7
61 */
62declare class NavigatorAttribute extends CommonMethod<NavigatorAttribute> {
63  /**
64   * Called when determining whether the routing component is active.
65   * @since 7
66   */
67  active(value: boolean): NavigatorAttribute;
68
69  /**
70   * Called when determining whether the routing component is active.
71   * @since 7
72   */
73  type(value: NavigationType): NavigatorAttribute;
74
75  /**
76   * Called when the path to the specified jump target page is set.
77   * @since 7
78   */
79  target(value: string): NavigatorAttribute;
80
81  /**
82   * Called when data is passed to the target page at the same time during jump.
83   * @since 7
84   */
85  params(value: object): NavigatorAttribute;
86}
87
88/**
89 * Defines Navigator Component.
90 * @since 7
91 */
92declare const Navigator: NavigatorInterface;
93
94/**
95 * Defines Navigator Component instance.
96 * @since 7
97 */
98declare const NavigatorInstance: NavigatorAttribute;
99