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