From 578e7e79439bef97d56e8132a27c67b34af8f106 Mon Sep 17 00:00:00 2001 From: zhaoxinyu Date: Wed, 28 Sep 2022 14:35:09 +0800 Subject: [PATCH] modify ArkUI JS API inform, add err code Signed-off-by: zhaoxinyu Change-Id: Ie1aa84d6d3ee1b50563f01159d73b66744466fa9 --- api/@ohos.animator.d.ts | 50 ++++++++- api/@ohos.curves.d.ts | 54 +++++++++ api/@ohos.matrix4.d.ts | 20 ++++ api/@ohos.prompt.d.ts | 2 + api/@ohos.promptAction.d.ts | 217 ++++++++++++++++++++++++++++++++++++ api/@ohos.router.d.ts | 154 ++++++++++++++++++++++--- 6 files changed, 480 insertions(+), 17 deletions(-) create mode 100644 api/@ohos.promptAction.d.ts diff --git a/api/@ohos.animator.d.ts b/api/@ohos.animator.d.ts index 3f4360181c..5e56e954fe 100644 --- a/api/@ohos.animator.d.ts +++ b/api/@ohos.animator.d.ts @@ -15,6 +15,7 @@ /** * Defines the animator options. + * @interface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ @@ -22,6 +23,7 @@ export interface AnimatorOptions { /** * Duration of the animation, in milliseconds. * The default value is 0. + * @type {number} * @since 6 */ duration: number; @@ -44,6 +46,7 @@ export interface AnimatorOptions { * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1. * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end. * The default value is ease. + * @type {string} * @since 6 */ easing: string; @@ -51,6 +54,7 @@ export interface AnimatorOptions { /** * Delay for the animation start. The default value indicates no delay. * The default value is 0. + * @type {number} * @since 6 */ delay: number; @@ -59,6 +63,7 @@ export interface AnimatorOptions { * Whether to resume to the initial state after the animation is executed. * none: The initial state is restored after the animation is executed. * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed. + * @type {string} * @since 6 */ fill: "none" | "forwards" | "backwards" | "both"; @@ -66,6 +71,7 @@ export interface AnimatorOptions { /** * The animation playback mode. * The default value is "normal". + * @type {string} * @since 6 */ direction: "normal" | "reverse" | "alternate" | "alternate-reverse"; @@ -73,6 +79,7 @@ export interface AnimatorOptions { /** * Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations. * The default value is 1. + * @type {number} * @since 6 */ iterations: number; @@ -80,6 +87,7 @@ export interface AnimatorOptions { /** * Starting point of animator interpolation. * The default value is 0. + * @type {number} * @since 6 */ begin: number; @@ -87,6 +95,7 @@ export interface AnimatorOptions { /** * Ending point of Dynamic Interpolation * The default value is 1. + * @type {number} * @since 6 */ end: number; @@ -94,59 +103,81 @@ export interface AnimatorOptions { /** * Defines the Animator result interface. + * @interface * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ export interface AnimatorResult { /** * Update the options for current animator. - * @param options Options. + * @param { AnimatorOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 + * @deprecated since 9 + * @useinstead ohos.animator.reset */ update(options: AnimatorOptions): void; + /** + * Reset the options for current animator. + * @param { AnimatorOptions } options - Options. + * @throws { BusinessError } 401 - if the type of the parameter 1 is not object. + * @throws { BusinessError } 100001 - if no page is found for pageId or fail to get object property list. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + reset(options: AnimatorOptions): void; /** * Starts the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ play(): void; /** * Ends the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ finish(): void; /** * Pauses the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ pause(): void; /** * Cancels the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ cancel(): void; /** * Plays the animation in reverse direction. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ reverse(): void; /** * Trigger when vsync callback. - * @param progress The current progress of animtion + * @param { number } progress - The current progress of animtion + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ onframe: (progress: number) => void; /** * The animation is finished. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ onfinish: () => void; /** * The animation is canceled. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ oncancel: () => void; /** * The animation is repeated. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 */ onrepeat: () => void; @@ -160,9 +191,20 @@ export interface AnimatorResult { */ export default class Animator { /** - * Create an animator object for custum animation. - * @param options Options. + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 6 + * @deprecated since 9 + * @useinstead ohos.animator.create */ static createAnimator(options: AnimatorOptions): AnimatorResult; + /** + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @throws { BusinessError } 401 - if parameter error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + static create(options: AnimatorOptions): AnimatorResult; } diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts index 0b03e393f7..4eb74e0d97 100644 --- a/api/@ohos.curves.d.ts +++ b/api/@ohos.curves.d.ts @@ -16,12 +16,15 @@ /** * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. * @import import Curves from '@ohos.curves' + * @namespace curves * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ declare namespace curves { /** * enum Curve. + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ enum Curve { @@ -42,11 +45,16 @@ declare namespace curves { /** * Interface for curve object. + * @typedef ICurve + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ interface ICurve { /** * Get curve value by fraction. + * @param { number } fraction + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ interpolate(fraction : number) : number; @@ -54,12 +62,18 @@ declare namespace curves { /** * Initializes the interpolator curve when called. + * @param { Curve } [curve] + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ function initCurve(curve?: Curve): ICurve; /** * Initializes the interpolator curve when called. + * @param { Curve } [curve] + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ @@ -67,12 +81,20 @@ declare namespace curves { /** * Constructs a step curve when called. + * @param { number } count + * @param { boolean } end + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ function stepsCurve(count: number, end: boolean): ICurve; /** * Constructs a step curve when called. + * @param { number } count + * @param { boolean } end + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ @@ -80,12 +102,22 @@ declare namespace curves { /** * Constructs a third-order Bezier curve when called. + * @param { number } x1 + * @param { number } y1 + * @param { number } y2 + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ function cubicBezierCurve(x1: number, y1: number, x2: number, y2: number): ICurve; /** * Constructs a third-order Bezier curve when called. + * @param { number } x1 + * @param { number } y1 + * @param { number } y2 + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ @@ -93,12 +125,24 @@ declare namespace curves { /** * Constructs a spring curve when called. + * @param { number } velocity + * @param { number } mass + * @param { number } stiffness + * @param { number } damping + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ function springCurve(velocity: number, mass: number, stiffness: number, damping: number): ICurve; /** * Constructs a spring curve when called. + * @param { number } velocity + * @param { number } mass + * @param { number } stiffness + * @param { number } damping + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 */ @@ -107,6 +151,11 @@ declare namespace curves { /** * Constructs a spring motion when called. * If one parameter is not specified, it uses the corresponding default values. + * @param { number } [response] + * @param { number } [dampingFraction] + * @param { number } [overlapDuration] + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @systemapi */ @@ -115,6 +164,11 @@ declare namespace curves { /** * Constructs a responsive spring motion when called. * If one parameter is not specified, it uses the corresponding default values. + * @param { number } [response] + * @param { number } [dampingFraction] + * @param { number } [overlapDuration] + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 * @systemapi */ diff --git a/api/@ohos.matrix4.d.ts b/api/@ohos.matrix4.d.ts index 9f779cf317..5e6b02b649 100644 --- a/api/@ohos.matrix4.d.ts +++ b/api/@ohos.matrix4.d.ts @@ -22,6 +22,7 @@ declare namespace matrix4 { /** * Set translation parameters + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ interface TranslateOption { @@ -46,6 +47,7 @@ declare namespace matrix4 { /** * Set scaling parameters + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ interface ScaleOption { @@ -82,6 +84,7 @@ declare namespace matrix4 { /** * Set Rotation Parameters. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ interface RotateOption { @@ -124,11 +127,13 @@ declare namespace matrix4 { /** * Matrix4Transit. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 */ interface Matrix4Transit { /** * Copy function of Matrix, which can copy a copy of the current matrix object. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -136,6 +141,7 @@ declare namespace matrix4 { /** * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -143,6 +149,7 @@ declare namespace matrix4 { /** * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -150,6 +157,7 @@ declare namespace matrix4 { /** * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -157,6 +165,7 @@ declare namespace matrix4 { /** * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -164,6 +173,7 @@ declare namespace matrix4 { /** * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -171,6 +181,7 @@ declare namespace matrix4 { /** * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -179,6 +190,7 @@ declare namespace matrix4 { /** * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -205,6 +217,7 @@ declare namespace matrix4 { /** * Matrix initialization function, which can return an identity matrix object. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -212,6 +225,7 @@ declare namespace matrix4 { /** * Copy function of Matrix, which can copy a copy of the current matrix object. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -219,6 +233,7 @@ declare namespace matrix4 { /** * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -226,6 +241,7 @@ declare namespace matrix4 { /** * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -233,6 +249,7 @@ declare namespace matrix4 { /** * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -240,6 +257,7 @@ declare namespace matrix4 { /** * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -247,6 +265,7 @@ declare namespace matrix4 { /** * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ @@ -254,6 +273,7 @@ declare namespace matrix4 { /** * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @return Return to Matrix4Transit */ diff --git a/api/@ohos.prompt.d.ts b/api/@ohos.prompt.d.ts index e2d0bdfb31..7a9c861e1d 100644 --- a/api/@ohos.prompt.d.ts +++ b/api/@ohos.prompt.d.ts @@ -22,6 +22,8 @@ import { Resource } from 'GlobalResource'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 * @import prompt from '@ohos.prompt'; + * @deprecated since 9 + * @useinstead ohos.promptAction */ declare namespace prompt { diff --git a/api/@ohos.promptAction.d.ts b/api/@ohos.promptAction.d.ts new file mode 100644 index 0000000000..478755f04b --- /dev/null +++ b/api/@ohos.promptAction.d.ts @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// + +import { AsyncCallback } from './basic'; +import { Resource } from 'GlobalResource'; + +/** + * @namespace promptAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @import prompt from '@ohos.promptAction'; + */ +declare namespace promptAction { + + /** + * @typedef ShowToastOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface ShowToastOptions { + + /** + * Text to display. + * @type { string | Resource } + * @since 9 + */ + message: string | Resource; + + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. + * @type { number } + * @since 9 + */ + duration?: number; + + /** + * The distance between toast dialog box and the bottom of screen. + * @type { string | number } + * @since 9 + */ + bottom?: string | number; + } + + /** + * @typedef Button + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface Button { + + /** + * @type { string | Resource } + * @since 9 + */ + text: string | Resource; + + /** + * @type { string | Resource } + * @since 9 + */ + color: string | Resource; + } + + /** + * @typedef ShowDialogSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface ShowDialogSuccessResponse { + + /** + * @type { number } + * @since 9 + */ + index: number; + } + + /** + * @typedef ShowDialogOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface ShowDialogOptions { + + /** + * Title of the text to display. + * @type { string | Resource } + * @since 9 + */ + title?: string | Resource; + + /** + * Text body. + * @type { string | Resource } + * @since 9 + */ + message?: string | Resource; + + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to three buttons are supported. The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. + * @since 9 + */ + buttons?: [Button, Button?, Button?]; + } + + /** + * @typedef ActionMenuSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface ActionMenuSuccessResponse { + + /** + * @type { number } + * @since 9 + */ + index: number; + } + + /** + * @typedef ActionMenuOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + interface ActionMenuOptions { + + /** + * Title of the text to display. + * @type { string | Resource } + * @since 9 + */ + title?: string | Resource; + + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to six buttons are supported. + * @since 9 + */ + buttons: [Button, Button?, Button?, Button?, Button?, Button?]; + } + + /** + * Displays the notification text. + * @param { ShowToastOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @throws { BusinessError } 401 - if the type of message is incorrect. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function showToast(options: ShowToastOptions):void; + + /** + * Displays the dialog box. + * @param { ShowDialogOptions } options - Options. + * @param { AsyncCallback } callback - the callback of showDialog. + * @throws { BusinessError } 401 - if the number of parameters is not 1 or the type of parameters is incorrect. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function showDialog(options: ShowDialogOptions, callback: AsyncCallback):void; + + /** + * Displays the dialog box. + * @param { ShowDialogOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not 1 or the type of parameters is incorrect. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function showDialog(options: ShowDialogOptions): Promise; + + /** + * Displays the menu. + * @param { ActionMenuOptions } options - Options. + * @param { AsyncCallback } callback - the callback of showActionMenu. + * @throws { BusinessError } 401 - if the number of parameters is not 1 or the type of parameters is incorrect. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback):void; + + /** + * Displays the dialog box. + * @param { ActionMenuOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not 1 or the type of parameters is incorrect. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function showActionMenu(options: ActionMenuOptions): Promise; +} + +export default prompt; diff --git a/api/@ohos.router.d.ts b/api/@ohos.router.d.ts index 62dcf85697..aebc1b06e5 100644 --- a/api/@ohos.router.d.ts +++ b/api/@ohos.router.d.ts @@ -14,8 +14,10 @@ */ import {Callback} from './basic'; +import { AsyncCallback } from './basic'; /** + * @namespace router * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 * @import router from '@ohos.router'; @@ -24,6 +26,7 @@ declare namespace router { /** * Router Mode + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ export enum RouterMode { @@ -41,6 +44,8 @@ declare namespace router { } /** + * @typedef RouterOptions + * @syscap SystemCapability.ArkUI.ArkUI.Lite * @since 8 */ interface RouterOptions { @@ -53,6 +58,7 @@ declare namespace router { * pages/detail/detail * 2. Particular path. If the URI is a slash (/), the home page is displayed. * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @type {string} * @since 8 */ url: string; @@ -62,12 +68,15 @@ declare namespace router { * After the destination page is displayed, the parameter can be directly used for the page. * For example, this.data1 (data1 is the key value of the params used for page navigation.) * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @type {Object} * @since 8 */ params?: Object; } /** + * @typedef RouterState + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ interface RouterState { @@ -75,30 +84,36 @@ declare namespace router { /** * Index of the current page in the stack. * NOTE: The index starts from 1 from the bottom to the top of the stack. + * @type {number} * @since 8 */ index: number; /** * Name of the current page, that is, the file name. + * @type {string} * @since 8 */ name: string; /** * Path of the current page. + * @type {string} * @since 8 */ path: string; } /** + * @typedef EnableAlertOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ interface EnableAlertOptions { /** * dialog context. + * @type {string} * @since 8 */ message: string; @@ -106,77 +121,190 @@ declare namespace router { /** * Navigates to a specified page in the application based on the page URL and parameters. - * @param options Options. + * @param { RouterOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 + * @deprecated since 9 + * @useinstead ohos.router.router#pushUrl */ function push(options: RouterOptions):void; /** * Navigates to a specified page in the application based on the page URL and parameters. - * @param options Options. - * @param mode RouterMode + * @param { RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @throws { BusinessError } 100002 - if the uri is not exist. + * @throws { BusinessError } 100003 - if the pages are pushed too much. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 9 */ - function push(options: RouterOptions, mode: RouterMode):void; + function pushUrl(options: RouterOptions, callback: AsyncCallback):void; + + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @throws { BusinessError } 100002 - if the uri is not exist. + * @throws { BusinessError } 100003 - if the pages are pushed too much. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function pushUrl(options: RouterOptions): Promise; + + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { RouterOptions } options - Options. + * @param { RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @throws { BusinessError } 100002 - if the uri is not exist. + * @throws { BusinessError } 100003 - if the pages are pushed too much. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback):void; + + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { RouterOptions } options - Options. + * @param { RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @throws { BusinessError } 100002 - if the uri is not exist. + * @throws { BusinessError } 100003 - if the pages are pushed too much. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function pushUrl(options: RouterOptions, mode: RouterMode): Promise; /** * Replaces the current page with another one in the application. The current page is destroyed after replacement. - * @param options Options. + * @param { RouterOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Lite * @since 8 + * @deprecated since 9 + * @useinstead ohos.router.router#replaceUrl */ function replace(options: RouterOptions):void; /** * Replaces the current page with another one in the application. The current page is destroyed after replacement. - * @param options Options. - * @param mode RouterMode + * @param { RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - if the uri is not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 9 + */ + function replaceUrl(options: RouterOptions, callback: AsyncCallback):void; + + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - if the uri is not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Lite * @since 9 */ - function replace(options: RouterOptions, mode: RouterMode):void; + function replaceUrl(options: RouterOptions): Promise; + + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { RouterOptions } options - Options. + * @param { RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - if the uri is not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 9 + */ + function replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback):void; + + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { RouterOptions } options - Options. + * @param { RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is not greater than or equal to 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if can not get the delegate, only throw in standard system. + * @throws { BusinessError } 200002 - if the uri is not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 9 + */ + function replaceUrl(options: RouterOptions, mode: RouterMode): Promise; /** * Returns to the previous page or a specified page. - * @param options Options. + * @param { RouterOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function back(options?: RouterOptions):void; /** * Clears all historical pages and retains only the current page at the top of the stack. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function clear():void; /** * Obtains the number of pages in the current stack. - * @returns Number of pages in the stack. The maximum value is 32. + * @returns { string } Number of pages in the stack. The maximum value is 32. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function getLength():string; /** * Obtains information about the current page state. - * @returns Page state. + * @returns { RouterState }Page state. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function getState():RouterState; /** * Pop up dialog to ask whether to back - * @param options Options. + * @param { EnableAlertOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 + * @deprecated since 9 + * @useinstead ohos.router.router#enableBackPageAlert */ function enableAlertBeforeBackPage(options: EnableAlertOptions):void; + /** + * Pop up dialog to ask whether to back + * @param { EnableAlertOptions } options - Options. + * @throws { BusinessError } 401 - if the type of the parameter is not object or the type of the message is not string. + * @throws { BusinessError } 100001 - if UI execution context not found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + function enableBackPageAlert(options: EnableAlertOptions):void; + /** * cancel enableAlertBeforeBackPage + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function disableAlertBeforeBackPage():void; /** * Obtains information about the current page params. - * @returns Page params. + * @returns { Object }Page params. + * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 8 */ function getParams(): Object; -- Gitee