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 * @file 18 * @kit ArkUI 19 */ 20 21import { AsyncCallback } from './@ohos.base'; 22 23/** 24 * @namespace router 25 * @syscap SystemCapability.ArkUI.ArkUI.Full 26 * @since 8 27 */ 28/** 29 * @namespace router 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @crossplatform 32 * @since 10 33 */ 34/** 35 * @namespace router 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @crossplatform 38 * @atomicservice 39 * @since 11 40 */ 41declare namespace router { 42 /** 43 * Router Mode 44 * 45 * @enum { number } 46 * @syscap SystemCapability.ArkUI.ArkUI.Full 47 * @since 9 48 */ 49 /** 50 * Router Mode 51 * 52 * @enum { number } 53 * @syscap SystemCapability.ArkUI.ArkUI.Full 54 * @crossplatform 55 * @since 10 56 */ 57 /** 58 * Router Mode 59 * 60 * @enum { number } 61 * @syscap SystemCapability.ArkUI.ArkUI.Full 62 * @crossplatform 63 * @atomicservice 64 * @since 11 65 */ 66 export enum RouterMode { 67 /** 68 * Default route mode. 69 * The page will be added to the top of the page stack. 70 * 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @since 9 73 */ 74 /** 75 * Default route mode. 76 * The page will be added to the top of the page stack. 77 * 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @since 10 81 */ 82 /** 83 * Default route mode. 84 * The page will be added to the top of the page stack. 85 * 86 * @syscap SystemCapability.ArkUI.ArkUI.Full 87 * @crossplatform 88 * @atomicservice 89 * @since 11 90 */ 91 Standard, 92 93 /** 94 * Single route mode. 95 * If the target page already has the same url page in the page stack, 96 * the same url page closest to the top of the stack will be moved to the top of the stack. 97 * If the target page url does not exist in the page stack, route will use default route mode. 98 * 99 * @syscap SystemCapability.ArkUI.ArkUI.Full 100 * @since 9 101 */ 102 /** 103 * Single route mode. 104 * If the target page already has the same url page in the page stack, 105 * the same url page closest to the top of the stack will be moved to the top of the stack. 106 * If the target page url does not exist in the page stack, route will use default route mode. 107 * 108 * @syscap SystemCapability.ArkUI.ArkUI.Full 109 * @crossplatform 110 * @since 10 111 */ 112 /** 113 * Single route mode. 114 * If the target page already has the same url page in the page stack, 115 * the same url page closest to the top of the stack will be moved to the top of the stack. 116 * If the target page url does not exist in the page stack, route will use default route mode. 117 * 118 * @syscap SystemCapability.ArkUI.ArkUI.Full 119 * @crossplatform 120 * @atomicservice 121 * @since 11 122 */ 123 Single, 124 } 125 126 /** 127 * @typedef RouterOptions 128 * @syscap SystemCapability.ArkUI.ArkUI.Lite 129 * @since 8 130 */ 131 /** 132 * @typedef RouterOptions 133 * @syscap SystemCapability.ArkUI.ArkUI.Lite 134 * @atomicservice 135 * @since 11 136 */ 137 export interface RouterOptions { 138 /** 139 * URI of the destination page, which supports the following formats: 140 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. 141 * Example: 142 * pages/index/index 143 * pages/detail/detail 144 * 2. Particular path. If the URI is a slash (/), the home page is displayed. 145 * 146 * @type { string } 147 * @syscap SystemCapability.ArkUI.ArkUI.Lite 148 * @since 8 149 */ 150 /** 151 * URI of the destination page, which supports the following formats: 152 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. 153 * Example: 154 * pages/index/index 155 * pages/detail/detail 156 * 2. Particular path. If the URI is a slash (/), the home page is displayed. 157 * 158 * @type { string } 159 * @syscap SystemCapability.ArkUI.ArkUI.Lite 160 * @atomicservice 161 * @since 11 162 */ 163 url: string; 164 165 /** 166 * Data that needs to be passed to the destination page during navigation. 167 * After the destination page is displayed, the parameter can be directly used for the page. 168 * For example, this.data1 (data1 is the key value of the params used for page navigation.) 169 * 170 * @type { ?Object } 171 * @syscap SystemCapability.ArkUI.ArkUI.Lite 172 * @since 8 173 */ 174 /** 175 * Data that needs to be passed to the destination page during navigation. 176 * After the destination page is displayed, the parameter can be directly used for the page. 177 * For example, this.data1 (data1 is the key value of the params used for page navigation.) 178 * 179 * @type { ?Object } 180 * @syscap SystemCapability.ArkUI.ArkUI.Lite 181 * @atomicservice 182 * @since 11 183 */ 184 params?: Object; 185 186 /** 187 * Set router page stack can be recovered after application is destroyed. When router page stack is recovered, 188 * top page will be recovered, other page recovered when it backs. the default value is 'true'. 189 * 190 * @type { ?boolean } 191 * @syscap SystemCapability.ArkUI.ArkUI.Lite 192 * @since 13 193 */ 194 recoverable?: boolean; 195 } 196 197 /** 198 * @typedef RouterState 199 * @syscap SystemCapability.ArkUI.ArkUI.Full 200 * @since 8 201 */ 202 /** 203 * @typedef RouterState 204 * @syscap SystemCapability.ArkUI.ArkUI.Full 205 * @crossplatform 206 * @since 10 207 */ 208 /** 209 * @typedef RouterState 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @crossplatform 212 * @atomicservice 213 * @since 11 214 */ 215 export interface RouterState { 216 /** 217 * Index of the current page in the stack. 218 * NOTE: The index starts from 1 from the bottom to the top of the stack. 219 * 220 * @type { number } 221 * @syscap SystemCapability.ArkUI.ArkUI.Full 222 * @since 8 223 */ 224 /** 225 * Index of the current page in the stack. 226 * NOTE: The index starts from 1 from the bottom to the top of the stack. 227 * 228 * @type { number } 229 * @syscap SystemCapability.ArkUI.ArkUI.Full 230 * @crossplatform 231 * @since 10 232 */ 233 /** 234 * Index of the current page in the stack. 235 * NOTE: The index starts from 1 from the bottom to the top of the stack. 236 * 237 * @type { number } 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @crossplatform 240 * @atomicservice 241 * @since 11 242 */ 243 index: number; 244 245 /** 246 * Name of the current page, that is, the file name. 247 * 248 * @type { string } 249 * @syscap SystemCapability.ArkUI.ArkUI.Full 250 * @since 8 251 */ 252 /** 253 * Name of the current page, that is, the file name. 254 * 255 * @type { string } 256 * @syscap SystemCapability.ArkUI.ArkUI.Full 257 * @crossplatform 258 * @since 10 259 */ 260 /** 261 * Name of the current page, that is, the file name. 262 * 263 * @type { string } 264 * @syscap SystemCapability.ArkUI.ArkUI.Full 265 * @crossplatform 266 * @atomicservice 267 * @since 11 268 */ 269 name: string; 270 271 /** 272 * Path of the current page. 273 * 274 * @type { string } 275 * @syscap SystemCapability.ArkUI.ArkUI.Full 276 * @since 8 277 */ 278 /** 279 * Path of the current page. 280 * 281 * @type { string } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @since 10 285 */ 286 /** 287 * Path of the current page. 288 * 289 * @type { string } 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @crossplatform 292 * @atomicservice 293 * @since 11 294 */ 295 path: string; 296 297 /** 298 * Data that passed to the destination page during navigation. 299 * 300 * @type { Object } 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @crossplatform 303 * @atomicservice 304 * @since 12 305 */ 306 params: Object; 307 } 308 309 /** 310 * @typedef EnableAlertOptions 311 * @syscap SystemCapability.ArkUI.ArkUI.Full 312 * @since 8 313 */ 314 /** 315 * @typedef EnableAlertOptions 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @since 10 319 */ 320 /** 321 * @typedef EnableAlertOptions 322 * @syscap SystemCapability.ArkUI.ArkUI.Full 323 * @crossplatform 324 * @atomicservice 325 * @since 11 326 */ 327 export interface EnableAlertOptions { 328 /** 329 * dialog context. 330 * 331 * @type { string } 332 * @syscap SystemCapability.ArkUI.ArkUI.Full 333 * @since 8 334 */ 335 /** 336 * dialog context. 337 * 338 * @type { string } 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @crossplatform 341 * @since 10 342 */ 343 /** 344 * dialog context. 345 * 346 * @type { string } 347 * @syscap SystemCapability.ArkUI.ArkUI.Full 348 * @crossplatform 349 * @atomicservice 350 * @since 11 351 */ 352 message: string; 353 } 354 355 /** 356 * Navigates to a specified page in the application based on the page URL and parameters. 357 * 358 * @param { RouterOptions } options - Options. 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @since 8 361 * @deprecated since 9 362 * @useinstead ohos.router.router#pushUrl 363 */ 364 export function push(options: RouterOptions): void; 365 366 /** 367 * Navigates to a specified page in the application based on the page URL and parameters. 368 * 369 * @param { RouterOptions } options - Options. 370 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 371 * @throws { BusinessError } 401 - Parameter error. Possible causes: 372 * <br> 1. Mandatory parameters are left unspecified. 373 * <br> 2. Incorrect parameters types. 374 * <br> 3. Parameter verification failed. 375 * @throws { BusinessError } 100001 - Internal error. 376 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 377 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 378 * @syscap SystemCapability.ArkUI.ArkUI.Full 379 * @since 9 380 */ 381 /** 382 * Navigates to a specified page in the application based on the page URL and parameters. 383 * 384 * @param { RouterOptions } options - Options. 385 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 386 * @throws { BusinessError } 401 - Parameter error. Possible causes: 387 * <br> 1. Mandatory parameters are left unspecified. 388 * <br> 2. Incorrect parameters types. 389 * <br> 3. Parameter verification failed. 390 * @throws { BusinessError } 100001 - Internal error. 391 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 392 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 393 * @syscap SystemCapability.ArkUI.ArkUI.Full 394 * @crossplatform 395 * @since 10 396 */ 397 /** 398 * Navigates to a specified page in the application based on the page URL and parameters. 399 * 400 * @param { RouterOptions } options - Options. 401 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 402 * @throws { BusinessError } 401 - Parameter error. Possible causes: 403 * <br> 1. Mandatory parameters are left unspecified. 404 * <br> 2. Incorrect parameters types. 405 * <br> 3. Parameter verification failed. 406 * @throws { BusinessError } 100001 - Internal error. 407 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 408 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 409 * @syscap SystemCapability.ArkUI.ArkUI.Full 410 * @crossplatform 411 * @atomicservice 412 * @since 11 413 */ 414 export function pushUrl(options: RouterOptions, callback: AsyncCallback<void>): void; 415 416 /** 417 * Navigates to a specified page in the application based on the page URL and parameters. 418 * 419 * @param { RouterOptions } options - Options. 420 * @returns { Promise<void> } the promise returned by the function. 421 * @throws { BusinessError } 401 - Parameter error. Possible causes: 422 * <br> 1. Mandatory parameters are left unspecified. 423 * <br> 2. Incorrect parameters types. 424 * <br> 3. Parameter verification failed. 425 * @throws { BusinessError } 100001 - Internal error. 426 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 427 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 428 * @syscap SystemCapability.ArkUI.ArkUI.Full 429 * @since 9 430 */ 431 /** 432 * Navigates to a specified page in the application based on the page URL and parameters. 433 * 434 * @param { RouterOptions } options - Options. 435 * @returns { Promise<void> } the promise returned by the function. 436 * @throws { BusinessError } 401 - Parameter error. Possible causes: 437 * <br> 1. Mandatory parameters are left unspecified. 438 * <br> 2. Incorrect parameters types. 439 * <br> 3. Parameter verification failed. 440 * @throws { BusinessError } 100001 - Internal error. 441 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 442 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 443 * @syscap SystemCapability.ArkUI.ArkUI.Full 444 * @crossplatform 445 * @since 10 446 */ 447 /** 448 * Navigates to a specified page in the application based on the page URL and parameters. 449 * 450 * @param { RouterOptions } options - Options. 451 * @returns { Promise<void> } the promise returned by the function. 452 * @throws { BusinessError } 401 - Parameter error. Possible causes: 453 * <br> 1. Mandatory parameters are left unspecified. 454 * <br> 2. Incorrect parameters types. 455 * <br> 3. Parameter verification failed. 456 * @throws { BusinessError } 100001 - Internal error. 457 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 458 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 459 * @syscap SystemCapability.ArkUI.ArkUI.Full 460 * @crossplatform 461 * @atomicservice 462 * @since 11 463 */ 464 export function pushUrl(options: RouterOptions): Promise<void>; 465 466 /** 467 * Navigates to a specified page in the application based on the page URL and parameters. 468 * 469 * @param { RouterOptions } options - Options. 470 * @param { RouterMode } mode - RouterMode. 471 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 472 * @throws { BusinessError } 401 - Parameter error. Possible causes: 473 * <br> 1. Mandatory parameters are left unspecified. 474 * <br> 2. Incorrect parameters types. 475 * <br> 3. Parameter verification failed. 476 * @throws { BusinessError } 100001 - Internal error. 477 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 478 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @since 9 481 */ 482 /** 483 * Navigates to a specified page in the application based on the page URL and parameters. 484 * 485 * @param { RouterOptions } options - Options. 486 * @param { RouterMode } mode - RouterMode. 487 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 488 * @throws { BusinessError } 401 - Parameter error. Possible causes: 489 * <br> 1. Mandatory parameters are left unspecified. 490 * <br> 2. Incorrect parameters types. 491 * <br> 3. Parameter verification failed. 492 * @throws { BusinessError } 100001 - Internal error. 493 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 494 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 495 * @syscap SystemCapability.ArkUI.ArkUI.Full 496 * @crossplatform 497 * @since 10 498 */ 499 /** 500 * Navigates to a specified page in the application based on the page URL and parameters. 501 * 502 * @param { RouterOptions } options - Options. 503 * @param { RouterMode } mode - RouterMode. 504 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 505 * @throws { BusinessError } 401 - Parameter error. Possible causes: 506 * <br> 1. Mandatory parameters are left unspecified. 507 * <br> 2. Incorrect parameters types. 508 * <br> 3. Parameter verification failed. 509 * @throws { BusinessError } 100001 - Internal error. 510 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 511 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @atomicservice 515 * @since 11 516 */ 517 export function pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 518 519 /** 520 * Navigates to a specified page in the application based on the page URL and parameters. 521 * 522 * @param { RouterOptions } options - Options. 523 * @param { RouterMode } mode - RouterMode. 524 * @returns { Promise<void> } the promise returned by the function. 525 * @throws { BusinessError } 401 - Parameter error. Possible causes: 526 * <br> 1. Mandatory parameters are left unspecified. 527 * <br> 2. Incorrect parameters types. 528 * <br> 3. Parameter verification failed. 529 * @throws { BusinessError } 100001 - Internal error. 530 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 531 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 532 * @syscap SystemCapability.ArkUI.ArkUI.Full 533 * @since 9 534 */ 535 /** 536 * Navigates to a specified page in the application based on the page URL and parameters. 537 * 538 * @param { RouterOptions } options - Options. 539 * @param { RouterMode } mode - RouterMode. 540 * @returns { Promise<void> } the promise returned by the function. 541 * @throws { BusinessError } 401 - Parameter error. Possible causes: 542 * <br> 1. Mandatory parameters are left unspecified. 543 * <br> 2. Incorrect parameters types. 544 * <br> 3. Parameter verification failed. 545 * @throws { BusinessError } 100001 - Internal error. 546 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 547 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 548 * @syscap SystemCapability.ArkUI.ArkUI.Full 549 * @crossplatform 550 * @since 10 551 */ 552 /** 553 * Navigates to a specified page in the application based on the page URL and parameters. 554 * 555 * @param { RouterOptions } options - Options. 556 * @param { RouterMode } mode - RouterMode. 557 * @returns { Promise<void> } the promise returned by the function. 558 * @throws { BusinessError } 401 - Parameter error. Possible causes: 559 * <br> 1. Mandatory parameters are left unspecified. 560 * <br> 2. Incorrect parameters types. 561 * <br> 3. Parameter verification failed. 562 * @throws { BusinessError } 100001 - Internal error. 563 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 564 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 565 * @syscap SystemCapability.ArkUI.ArkUI.Full 566 * @crossplatform 567 * @atomicservice 568 * @since 11 569 */ 570 export function pushUrl(options: RouterOptions, mode: RouterMode): Promise<void>; 571 572 /** 573 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 574 * 575 * @param { RouterOptions } options - Options. 576 * @syscap SystemCapability.ArkUI.ArkUI.Lite 577 * @since 8 578 * @deprecated since 9 579 * @useinstead ohos.router.router#replaceUrl 580 */ 581 export function replace(options: RouterOptions): void; 582 583 /** 584 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 585 * 586 * @param { RouterOptions } options - Options. 587 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 588 * @throws { BusinessError } 401 - Parameter error. Possible causes: 589 * <br> 1. Mandatory parameters are left unspecified. 590 * <br> 2. Incorrect parameters types. 591 * <br> 3. Parameter verification failed. 592 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 593 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 594 * @syscap SystemCapability.ArkUI.ArkUI.Lite 595 * @since 9 596 */ 597 /** 598 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 599 * 600 * @param { RouterOptions } options - Options. 601 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 603 * <br> 1. Mandatory parameters are left unspecified. 604 * <br> 2. Incorrect parameters types. 605 * <br> 3. Parameter verification failed. 606 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 607 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 608 * @syscap SystemCapability.ArkUI.ArkUI.Lite 609 * @atomicservice 610 * @since 11 611 */ 612 export function replaceUrl(options: RouterOptions, callback: AsyncCallback<void>): void; 613 614 /** 615 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 616 * 617 * @param { RouterOptions } options - Options. 618 * @returns { Promise<void> } the promise returned by the function. 619 * @throws { BusinessError } 401 - Parameter error. Possible causes: 620 * <br> 1. Mandatory parameters are left unspecified. 621 * <br> 2. Incorrect parameters types. 622 * <br> 3. Parameter verification failed. 623 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 624 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 625 * @syscap SystemCapability.ArkUI.ArkUI.Lite 626 * @since 9 627 */ 628 /** 629 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 630 * 631 * @param { RouterOptions } options - Options. 632 * @returns { Promise<void> } the promise returned by the function. 633 * @throws { BusinessError } 401 - Parameter error. Possible causes: 634 * <br> 1. Mandatory parameters are left unspecified. 635 * <br> 2. Incorrect parameters types. 636 * <br> 3. Parameter verification failed. 637 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 638 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 639 * @syscap SystemCapability.ArkUI.ArkUI.Lite 640 * @atomicservice 641 * @since 11 642 */ 643 export function replaceUrl(options: RouterOptions): Promise<void>; 644 645 /** 646 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 647 * 648 * @param { RouterOptions } options - Options. 649 * @param { RouterMode } mode - RouterMode. 650 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 652 * <br> 1. Mandatory parameters are left unspecified. 653 * <br> 2. Incorrect parameters types. 654 * <br> 3. Parameter verification failed. 655 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 656 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 657 * @syscap SystemCapability.ArkUI.ArkUI.Lite 658 * @since 9 659 */ 660 /** 661 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 662 * 663 * @param { RouterOptions } options - Options. 664 * @param { RouterMode } mode - RouterMode. 665 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 666 * @throws { BusinessError } 401 - Parameter error. Possible causes: 667 * <br> 1. Mandatory parameters are left unspecified. 668 * <br> 2. Incorrect parameters types. 669 * <br> 3. Parameter verification failed. 670 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 671 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 672 * @syscap SystemCapability.ArkUI.ArkUI.Lite 673 * @atomicservice 674 * @since 11 675 */ 676 export function replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 677 678 /** 679 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 680 * 681 * @param { RouterOptions } options - Options. 682 * @param { RouterMode } mode - RouterMode. 683 * @returns { Promise<void> } the promise returned by the function. 684 * @throws { BusinessError } 401 - Parameter error. Possible causes: 685 * <br> 1. Mandatory parameters are left unspecified. 686 * <br> 2. Incorrect parameters types. 687 * <br> 3. Parameter verification failed. 688 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 689 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 690 * @syscap SystemCapability.ArkUI.ArkUI.Lite 691 * @since 9 692 */ 693 /** 694 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 695 * 696 * @param { RouterOptions } options - Options. 697 * @param { RouterMode } mode - RouterMode. 698 * @returns { Promise<void> } the promise returned by the function. 699 * @throws { BusinessError } 401 - Parameter error. Possible causes: 700 * <br> 1. Mandatory parameters are left unspecified. 701 * <br> 2. Incorrect parameters types. 702 * <br> 3. Parameter verification failed. 703 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 704 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 705 * @syscap SystemCapability.ArkUI.ArkUI.Lite 706 * @atomicservice 707 * @since 11 708 */ 709 export function replaceUrl(options: RouterOptions, mode: RouterMode): Promise<void>; 710 711 /** 712 * Returns to the previous page or a specified page. 713 * 714 * @param { RouterOptions } options - Options. 715 * @syscap SystemCapability.ArkUI.ArkUI.Full 716 * @since 8 717 */ 718 /** 719 * Returns to the previous page or a specified page. 720 * 721 * @param { RouterOptions } options - Options. 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @since 10 725 */ 726 /** 727 * Returns to the previous page or a specified page. 728 * 729 * @param { RouterOptions } options - Options. 730 * @syscap SystemCapability.ArkUI.ArkUI.Full 731 * @crossplatform 732 * @atomicservice 733 * @since 11 734 */ 735 export function back(options?: RouterOptions): void; 736 737 /** 738 * Returns to the specified page. 739 * 740 * @param { number } index - index of page. 741 * @param { Object } [params] - params of page. 742 * @syscap SystemCapability.ArkUI.ArkUI.Full 743 * @crossplatform 744 * @atomicservice 745 * @since 12 746 */ 747 export function back(index: number, params?: Object): void; 748 749 /** 750 * Clears all historical pages and retains only the current page at the top of the stack. 751 * 752 * @syscap SystemCapability.ArkUI.ArkUI.Full 753 * @since 8 754 */ 755 /** 756 * Clears all historical pages and retains only the current page at the top of the stack. 757 * 758 * @syscap SystemCapability.ArkUI.ArkUI.Full 759 * @crossplatform 760 * @since 10 761 */ 762 /** 763 * Clears all historical pages and retains only the current page at the top of the stack. 764 * 765 * @syscap SystemCapability.ArkUI.ArkUI.Full 766 * @crossplatform 767 * @atomicservice 768 * @since 11 769 */ 770 export function clear(): void; 771 772 /** 773 * Obtains the number of pages in the current stack. 774 * 775 * @returns { string } Number of pages in the stack. The maximum value is 32. 776 * @syscap SystemCapability.ArkUI.ArkUI.Full 777 * @since 8 778 */ 779 /** 780 * Obtains the number of pages in the current stack. 781 * 782 * @returns { string } Number of pages in the stack. The maximum value is 32. 783 * @syscap SystemCapability.ArkUI.ArkUI.Full 784 * @crossplatform 785 * @since 10 786 */ 787 /** 788 * Obtains the number of pages in the current stack. 789 * 790 * @returns { string } Number of pages in the stack. The maximum value is 32. 791 * @syscap SystemCapability.ArkUI.ArkUI.Full 792 * @crossplatform 793 * @atomicservice 794 * @since 11 795 */ 796 export function getLength(): string; 797 798 /** 799 * Obtains information about the current page state. 800 * 801 * @returns { RouterState } Page state. 802 * @syscap SystemCapability.ArkUI.ArkUI.Full 803 * @since 8 804 */ 805 /** 806 * Obtains information about the current page state. 807 * 808 * @returns { RouterState } Page state. 809 * @syscap SystemCapability.ArkUI.ArkUI.Full 810 * @crossplatform 811 * @since 10 812 */ 813 /** 814 * Obtains information about the current page state. 815 * 816 * @returns { RouterState } Page state. 817 * @syscap SystemCapability.ArkUI.ArkUI.Full 818 * @crossplatform 819 * @atomicservice 820 * @since 11 821 */ 822 export function getState(): RouterState; 823 824 /** 825 * Obtains page information by index. 826 * 827 * @param { number } index - Index of page. 828 * @returns { RouterState | undefined } Page state. 829 * @syscap SystemCapability.ArkUI.ArkUI.Full 830 * @crossplatform 831 * @atomicservice 832 * @since 12 833 */ 834 export function getStateByIndex(index: number): RouterState | undefined; 835 836 /** 837 * Obtains page information by url. 838 * 839 * @param { string } url - URL of page. 840 * @returns { Array<RouterState> } Page state. 841 * @syscap SystemCapability.ArkUI.ArkUI.Full 842 * @crossplatform 843 * @atomicservice 844 * @since 12 845 */ 846 export function getStateByUrl(url: string): Array<RouterState>; 847 848 /** 849 * Pop up dialog to ask whether to back 850 * 851 * @param { EnableAlertOptions } options - Options. 852 * @syscap SystemCapability.ArkUI.ArkUI.Full 853 * @since 8 854 * @deprecated since 9 855 * @useinstead ohos.router.router#showAlertBeforeBackPage 856 */ 857 export function enableAlertBeforeBackPage(options: EnableAlertOptions): void; 858 859 /** 860 * Pop up alert dialog to ask whether to back 861 * 862 * @param { EnableAlertOptions } options - Options. 863 * @throws { BusinessError } 401 - Parameter error. Possible causes: 864 * <br> 1. Mandatory parameters are left unspecified. 865 * <br> 2. Incorrect parameters types. 866 * <br> 3. Parameter verification failed. 867 * @throws { BusinessError } 100001 - Internal error. 868 * @syscap SystemCapability.ArkUI.ArkUI.Full 869 * @since 9 870 */ 871 /** 872 * Pop up alert dialog to ask whether to back 873 * 874 * @param { EnableAlertOptions } options - Options. 875 * @throws { BusinessError } 401 - Parameter error. Possible causes: 876 * <br> 1. Mandatory parameters are left unspecified. 877 * <br> 2. Incorrect parameters types. 878 * <br> 3. Parameter verification failed. 879 * @throws { BusinessError } 100001 - Internal error. 880 * @syscap SystemCapability.ArkUI.ArkUI.Full 881 * @crossplatform 882 * @since 10 883 */ 884 /** 885 * Pop up alert dialog to ask whether to back 886 * 887 * @param { EnableAlertOptions } options - Options. 888 * @throws { BusinessError } 401 - Parameter error. Possible causes: 889 * <br> 1. Mandatory parameters are left unspecified. 890 * <br> 2. Incorrect parameters types. 891 * <br> 3. Parameter verification failed. 892 * @throws { BusinessError } 100001 - Internal error. 893 * @syscap SystemCapability.ArkUI.ArkUI.Full 894 * @crossplatform 895 * @atomicservice 896 * @since 11 897 */ 898 export function showAlertBeforeBackPage(options: EnableAlertOptions): void; 899 900 /** 901 * Cancel enableAlertBeforeBackPage 902 * 903 * @syscap SystemCapability.ArkUI.ArkUI.Full 904 * @since 8 905 * @deprecated since 9 906 * @useinstead ohos.router.router#hideAlertBeforeBackPage 907 */ 908 export function disableAlertBeforeBackPage(): void; 909 910 /** 911 * Hide alert before back page 912 * 913 * @syscap SystemCapability.ArkUI.ArkUI.Full 914 * @since 9 915 */ 916 /** 917 * Hide alert before back page 918 * 919 * @syscap SystemCapability.ArkUI.ArkUI.Full 920 * @crossplatform 921 * @since 10 922 */ 923 /** 924 * Hide alert before back page 925 * 926 * @syscap SystemCapability.ArkUI.ArkUI.Full 927 * @crossplatform 928 * @atomicservice 929 * @since 11 930 */ 931 export function hideAlertBeforeBackPage(): void; 932 933 /** 934 * Obtains information about the current page params. 935 * 936 * @returns { Object } Page params. 937 * @syscap SystemCapability.ArkUI.ArkUI.Full 938 * @since 8 939 */ 940 /** 941 * Obtains information about the current page params. 942 * 943 * @returns { Object } Page params. 944 * @syscap SystemCapability.ArkUI.ArkUI.Full 945 * @crossplatform 946 * @since 10 947 */ 948 /** 949 * Obtains information about the current page params. 950 * 951 * @returns { Object } Page params. 952 * @syscap SystemCapability.ArkUI.ArkUI.Full 953 * @crossplatform 954 * @atomicservice 955 * @since 11 956 */ 957 export function getParams(): Object; 958 959 /** 960 * @typedef NamedRouterOptions 961 * @syscap SystemCapability.ArkUI.ArkUI.Full 962 * @crossplatform 963 * @since 10 964 */ 965 /** 966 * @typedef NamedRouterOptions 967 * @syscap SystemCapability.ArkUI.ArkUI.Full 968 * @crossplatform 969 * @atomicservice 970 * @since 11 971 */ 972 export interface NamedRouterOptions { 973 /** 974 * Name of the destination named route. 975 * 976 * @type { string } 977 * @syscap SystemCapability.ArkUI.ArkUI.Full 978 * @crossplatform 979 * @since 10 980 */ 981 /** 982 * Name of the destination named route. 983 * 984 * @type { string } 985 * @syscap SystemCapability.ArkUI.ArkUI.Full 986 * @crossplatform 987 * @atomicservice 988 * @since 11 989 */ 990 name: string; 991 992 /** 993 * Data that needs to be passed to the destination page during navigation. 994 * 995 * @type { ?Object } 996 * @syscap SystemCapability.ArkUI.ArkUI.Full 997 * @crossplatform 998 * @since 10 999 */ 1000 /** 1001 * Data that needs to be passed to the destination page during navigation. 1002 * 1003 * @type { ?Object } 1004 * @syscap SystemCapability.ArkUI.ArkUI.Full 1005 * @crossplatform 1006 * @atomicservice 1007 * @since 11 1008 */ 1009 params?: Object; 1010 1011 /** 1012 * Set router page stack can be recovered after application is destroyed. When router page stack is recovered, 1013 * top page will be recovered, other page recovered when it backs. the default value is 'true'. 1014 * 1015 * @type { ?boolean } 1016 * @syscap SystemCapability.ArkUI.ArkUI.Lite 1017 * @since 13 1018 */ 1019 recoverable?: boolean; 1020 } 1021 1022 /** 1023 * Navigates to a specified page in the application based on the page URL and parameters. 1024 * 1025 * @param { NamedRouterOptions } options - Options. 1026 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1027 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1028 * <br> 1. Mandatory parameters are left unspecified. 1029 * <br> 2. Incorrect parameters types. 1030 * <br> 3. Parameter verification failed. 1031 * @throws { BusinessError } 100001 - Internal error. 1032 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1033 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1034 * @syscap SystemCapability.ArkUI.ArkUI.Full 1035 * @crossplatform 1036 * @since 10 1037 */ 1038 /** 1039 * Navigates to a specified page in the application based on the page URL and parameters. 1040 * 1041 * @param { NamedRouterOptions } options - Options. 1042 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1043 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1044 * <br> 1. Mandatory parameters are left unspecified. 1045 * <br> 2. Incorrect parameters types. 1046 * <br> 3. Parameter verification failed. 1047 * @throws { BusinessError } 100001 - Internal error. 1048 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1049 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1050 * @syscap SystemCapability.ArkUI.ArkUI.Full 1051 * @crossplatform 1052 * @atomicservice 1053 * @since 11 1054 */ 1055 export function pushNamedRoute(options: NamedRouterOptions, callback: AsyncCallback<void>): void; 1056 1057 /** 1058 * Navigates to a specified page in the application based on the page URL and parameters. 1059 * 1060 * @param { NamedRouterOptions } options - Options. 1061 * @returns { Promise<void> } the promise returned by the function. 1062 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1063 * <br> 1. Mandatory parameters are left unspecified. 1064 * <br> 2. Incorrect parameters types. 1065 * <br> 3. Parameter verification failed. 1066 * @throws { BusinessError } 100001 - Internal error. 1067 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1068 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1069 * @syscap SystemCapability.ArkUI.ArkUI.Full 1070 * @crossplatform 1071 * @since 10 1072 */ 1073 /** 1074 * Navigates to a specified page in the application based on the page URL and parameters. 1075 * 1076 * @param { NamedRouterOptions } options - Options. 1077 * @returns { Promise<void> } the promise returned by the function. 1078 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1079 * <br> 1. Mandatory parameters are left unspecified. 1080 * <br> 2. Incorrect parameters types. 1081 * <br> 3. Parameter verification failed. 1082 * @throws { BusinessError } 100001 - Internal error. 1083 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1084 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1085 * @syscap SystemCapability.ArkUI.ArkUI.Full 1086 * @crossplatform 1087 * @atomicservice 1088 * @since 11 1089 */ 1090 export function pushNamedRoute(options: NamedRouterOptions): Promise<void>; 1091 1092 /** 1093 * Navigates to a specified page in the application based on the page URL and parameters. 1094 * 1095 * @param { NamedRouterOptions } options - Options. 1096 * @param { RouterMode } mode - RouterMode. 1097 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1098 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1099 * <br> 1. Mandatory parameters are left unspecified. 1100 * <br> 2. Incorrect parameters types. 1101 * <br> 3. Parameter verification failed. 1102 * @throws { BusinessError } 100001 - Internal error. 1103 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1104 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1105 * @syscap SystemCapability.ArkUI.ArkUI.Full 1106 * @crossplatform 1107 * @since 10 1108 */ 1109 /** 1110 * Navigates to a specified page in the application based on the page URL and parameters. 1111 * 1112 * @param { NamedRouterOptions } options - Options. 1113 * @param { RouterMode } mode - RouterMode. 1114 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1115 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1116 * <br> 1. Mandatory parameters are left unspecified. 1117 * <br> 2. Incorrect parameters types. 1118 * <br> 3. Parameter verification failed. 1119 * @throws { BusinessError } 100001 - Internal error. 1120 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1121 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1122 * @syscap SystemCapability.ArkUI.ArkUI.Full 1123 * @crossplatform 1124 * @atomicservice 1125 * @since 11 1126 */ 1127 export function pushNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 1128 1129 /** 1130 * Navigates to a specified page in the application based on the page URL and parameters. 1131 * 1132 * @param { NamedRouterOptions } options - Options. 1133 * @param { RouterMode } mode - RouterMode. 1134 * @returns { Promise<void> } the promise returned by the function. 1135 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1136 * <br> 1. Mandatory parameters are left unspecified. 1137 * <br> 2. Incorrect parameters types. 1138 * <br> 3. Parameter verification failed. 1139 * @throws { BusinessError } 100001 - Internal error. 1140 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1141 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1142 * @syscap SystemCapability.ArkUI.ArkUI.Full 1143 * @crossplatform 1144 * @since 10 1145 */ 1146 /** 1147 * Navigates to a specified page in the application based on the page URL and parameters. 1148 * 1149 * @param { NamedRouterOptions } options - Options. 1150 * @param { RouterMode } mode - RouterMode. 1151 * @returns { Promise<void> } the promise returned by the function. 1152 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1153 * <br> 1. Mandatory parameters are left unspecified. 1154 * <br> 2. Incorrect parameters types. 1155 * <br> 3. Parameter verification failed. 1156 * @throws { BusinessError } 100001 - Internal error. 1157 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1158 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1159 * @syscap SystemCapability.ArkUI.ArkUI.Full 1160 * @crossplatform 1161 * @atomicservice 1162 * @since 11 1163 */ 1164 export function pushNamedRoute(options: NamedRouterOptions, mode: RouterMode): Promise<void>; 1165 1166 /** 1167 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1168 * 1169 * @param { NamedRouterOptions } options - Options. 1170 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1171 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1172 * <br> 1. Mandatory parameters are left unspecified. 1173 * <br> 2. Incorrect parameters types. 1174 * <br> 3. Parameter verification failed. 1175 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1176 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1177 * @syscap SystemCapability.ArkUI.ArkUI.Full 1178 * @crossplatform 1179 * @since 10 1180 */ 1181 /** 1182 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1183 * 1184 * @param { NamedRouterOptions } options - Options. 1185 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1186 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1187 * <br> 1. Mandatory parameters are left unspecified. 1188 * <br> 2. Incorrect parameters types. 1189 * <br> 3. Parameter verification failed. 1190 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1191 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1192 * @syscap SystemCapability.ArkUI.ArkUI.Full 1193 * @crossplatform 1194 * @atomicservice 1195 * @since 11 1196 */ 1197 export function replaceNamedRoute(options: NamedRouterOptions, callback: AsyncCallback<void>): void; 1198 1199 /** 1200 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1201 * 1202 * @param { NamedRouterOptions } options - Options. 1203 * @returns { Promise<void> } the promise returned by the function. 1204 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1205 * <br> 1. Mandatory parameters are left unspecified. 1206 * <br> 2. Incorrect parameters types. 1207 * <br> 3. Parameter verification failed. 1208 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1209 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1210 * @syscap SystemCapability.ArkUI.ArkUI.Full 1211 * @crossplatform 1212 * @since 10 1213 */ 1214 /** 1215 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1216 * 1217 * @param { NamedRouterOptions } options - Options. 1218 * @returns { Promise<void> } the promise returned by the function. 1219 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1220 * <br> 1. Mandatory parameters are left unspecified. 1221 * <br> 2. Incorrect parameters types. 1222 * <br> 3. Parameter verification failed. 1223 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1224 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1225 * @syscap SystemCapability.ArkUI.ArkUI.Full 1226 * @crossplatform 1227 * @atomicservice 1228 * @since 11 1229 */ 1230 export function replaceNamedRoute(options: NamedRouterOptions): Promise<void>; 1231 1232 /** 1233 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1234 * 1235 * @param { NamedRouterOptions } options - Options. 1236 * @param { RouterMode } mode - RouterMode. 1237 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1238 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1239 * <br> 1. Mandatory parameters are left unspecified. 1240 * <br> 2. Incorrect parameters types. 1241 * <br> 3. Parameter verification failed. 1242 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1243 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1244 * @syscap SystemCapability.ArkUI.ArkUI.Full 1245 * @crossplatform 1246 * @since 10 1247 */ 1248 /** 1249 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1250 * 1251 * @param { NamedRouterOptions } options - Options. 1252 * @param { RouterMode } mode - RouterMode. 1253 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1254 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1255 * <br> 1. Mandatory parameters are left unspecified. 1256 * <br> 2. Incorrect parameters types. 1257 * <br> 3. Parameter verification failed. 1258 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1259 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1260 * @syscap SystemCapability.ArkUI.ArkUI.Full 1261 * @crossplatform 1262 * @atomicservice 1263 * @since 11 1264 */ 1265 export function replaceNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 1266 1267 /** 1268 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1269 * 1270 * @param { NamedRouterOptions } options - Options. 1271 * @param { RouterMode } mode - RouterMode. 1272 * @returns { Promise<void> } the promise returned by the function. 1273 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1274 * <br> 1. Mandatory parameters are left unspecified. 1275 * <br> 2. Incorrect parameters types. 1276 * <br> 3. Parameter verification failed. 1277 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 1278 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1279 * @syscap SystemCapability.ArkUI.ArkUI.Full 1280 * @crossplatform 1281 * @since 10 1282 */ 1283 /** 1284 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1285 * 1286 * @param { NamedRouterOptions } options - Options. 1287 * @param { RouterMode } mode - RouterMode. 1288 * @returns { Promise<void> } the promise returned by the function. 1289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1290 * <br> 1. Mandatory parameters are left unspecified. 1291 * <br> 2. Incorrect parameters types. 1292 * <br> 3. Parameter verification failed. 1293 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 1294 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1295 * @syscap SystemCapability.ArkUI.ArkUI.Full 1296 * @crossplatform 1297 * @atomicservice 1298 * @since 11 1299 */ 1300 export function replaceNamedRoute(options: NamedRouterOptions, mode: RouterMode): Promise<void>; 1301} 1302export default router;