1/* 2 * Copyright (c) 2023 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 type { Callback } from './@ohos.base'; 22import type UIAbilityContext from './application/UIAbilityContext'; 23import type { NavigationOperation, NavBar } from '../component/navigation'; 24 25/** 26 * Register callbacks to observe ArkUI behavior. 27 * 28 * @namespace uiObserver 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @crossplatform 31 * @since 11 32 */ 33/** 34 * Register callbacks to observe ArkUI behavior. 35 * 36 * @namespace uiObserver 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @atomicservice 40 * @since 12 41 */ 42declare namespace uiObserver { 43 /** 44 * NavDestination state. 45 * 46 * @enum { number } 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @crossplatform 49 * @form 50 * @since 11 51 */ 52 /** 53 * NavDestination state. 54 * 55 * @enum { number } 56 * @syscap SystemCapability.ArkUI.ArkUI.Full 57 * @crossplatform 58 * @form 59 * @atomicservice 60 * @since 12 61 */ 62 export enum NavDestinationState { 63 /** 64 * When the NavDestination is displayed. 65 * 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @crossplatform 68 * @form 69 * @since 11 70 */ 71 /** 72 * When the NavDestination displayed. 73 * 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @crossplatform 76 * @form 77 * @atomicservice 78 * @since 12 79 */ 80 ON_SHOWN = 0, 81 82 /** 83 * When the NavDestination is hidden. 84 * 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @crossplatform 87 * @form 88 * @since 11 89 */ 90 /** 91 * When the NavDestination is hidden. 92 * 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @form 96 * @atomicservice 97 * @since 12 98 */ 99 ON_HIDDEN = 1, 100 101 /** 102 * When the NavDestination appear. 103 * 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @crossplatform 106 * @form 107 * @atomicservice 108 * @since 12 109 */ 110 ON_APPEAR = 2, 111 112 /** 113 * When the NavDestination disappear. 114 * 115 * @syscap SystemCapability.ArkUI.ArkUI.Full 116 * @crossplatform 117 * @form 118 * @atomicservice 119 * @since 12 120 */ 121 ON_DISAPPEAR = 3, 122 123 /** 124 * Before the NavDestination is displayed. 125 * 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @crossplatform 128 * @form 129 * @atomicservice 130 * @since 12 131 */ 132 ON_WILL_SHOW = 4, 133 134 /** 135 * Before the NavDestination is hidden. 136 * 137 * @syscap SystemCapability.ArkUI.ArkUI.Full 138 * @crossplatform 139 * @form 140 * @atomicservice 141 * @since 12 142 */ 143 ON_WILL_HIDE = 5, 144 145 /** 146 * Before the NavDestination is appeared. 147 * 148 * @syscap SystemCapability.ArkUI.ArkUI.Full 149 * @crossplatform 150 * @form 151 * @atomicservice 152 * @since 12 153 */ 154 ON_WILL_APPEAR = 6, 155 156 /** 157 * Before the NavDestination is disappeared. 158 * 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @crossplatform 161 * @form 162 * @atomicservice 163 * @since 12 164 */ 165 ON_WILL_DISAPPEAR = 7, 166 167 /** 168 * When back press event happened in NavDestination. 169 * 170 * @syscap SystemCapability.ArkUI.ArkUI.Full 171 * @crossplatform 172 * @form 173 * @atomicservice 174 * @since 12 175 */ 176 ON_BACKPRESS = 100 177 } 178 179 /** 180 * Router page state. 181 * 182 * @enum { number } 183 * @syscap SystemCapability.ArkUI.ArkUI.Full 184 * @crossplatform 185 * @since 11 186 */ 187 /** 188 * Router page state. 189 * 190 * @enum { number } 191 * @syscap SystemCapability.ArkUI.ArkUI.Full 192 * @crossplatform 193 * @atomicservice 194 * @since 12 195 */ 196 export enum RouterPageState { 197 /** 198 * When the router page create. 199 * 200 * @syscap SystemCapability.ArkUI.ArkUI.Full 201 * @crossplatform 202 * @since 11 203 */ 204 /** 205 * When the router page create. 206 * 207 * @syscap SystemCapability.ArkUI.ArkUI.Full 208 * @crossplatform 209 * @atomicservice 210 * @since 12 211 */ 212 ABOUT_TO_APPEAR = 0, 213 214 /** 215 * When the router page destroy. 216 * 217 * @syscap SystemCapability.ArkUI.ArkUI.Full 218 * @crossplatform 219 * @since 11 220 */ 221 /** 222 * When the router page destroy. 223 * 224 * @syscap SystemCapability.ArkUI.ArkUI.Full 225 * @crossplatform 226 * @atomicservice 227 * @since 12 228 */ 229 ABOUT_TO_DISAPPEAR = 1, 230 231 /** 232 * When the router page show. 233 * 234 * @syscap SystemCapability.ArkUI.ArkUI.Full 235 * @crossplatform 236 * @since 11 237 */ 238 /** 239 * When the router page show. 240 * 241 * @syscap SystemCapability.ArkUI.ArkUI.Full 242 * @crossplatform 243 * @atomicservice 244 * @since 12 245 */ 246 ON_PAGE_SHOW = 2, 247 248 /** 249 * When the router page hide. 250 * 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @since 11 254 */ 255 /** 256 * When the router page hide. 257 * 258 * @syscap SystemCapability.ArkUI.ArkUI.Full 259 * @crossplatform 260 * @atomicservice 261 * @since 12 262 */ 263 ON_PAGE_HIDE = 3, 264 265 /** 266 * When back press event happened in the router page. 267 * 268 * @syscap SystemCapability.ArkUI.ArkUI.Full 269 * @crossplatform 270 * @since 11 271 */ 272 /** 273 * When back press event happened in the router page. 274 * 275 * @syscap SystemCapability.ArkUI.ArkUI.Full 276 * @crossplatform 277 * @atomicservice 278 * @since 12 279 */ 280 ON_BACK_PRESS = 4 281 } 282 283 /** 284 * ScrollEvent type. 285 * 286 * @enum { number } 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @crossplatform 289 * @atomicservice 290 * @since 12 291 */ 292 export enum ScrollEventType { 293 /** 294 * When the ScrollEvent start. 295 * 296 * @syscap SystemCapability.ArkUI.ArkUI.Full 297 * @crossplatform 298 * @atomicservice 299 * @since 12 300 */ 301 SCROLL_START = 0, 302 303 /** 304 * When the ScrollEvent stop. 305 * 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @atomicservice 309 * @since 12 310 */ 311 SCROLL_STOP = 1 312 } 313 314 /** 315 * TabContent state. 316 * 317 * @enum { number } 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @crossplatform 320 * @atomicservice 321 * @since 12 322 */ 323 export enum TabContentState { 324 /** 325 * When the TabContent hidden. 326 * 327 * @syscap SystemCapability.ArkUI.ArkUI.Full 328 * @crossplatform 329 * @atomicservice 330 * @since 12 331 */ 332 ON_SHOW = 0, 333 334 /** 335 * When the TabContent hidden. 336 * 337 * @syscap SystemCapability.ArkUI.ArkUI.Full 338 * @crossplatform 339 * @atomicservice 340 * @since 12 341 */ 342 ON_HIDE = 1 343 } 344 345 /** 346 * NavDestination info. 347 * 348 * @interface NavDestinationInfo 349 * @syscap SystemCapability.ArkUI.ArkUI.Full 350 * @crossplatform 351 * @since 11 352 */ 353 /** 354 * NavDestination info. 355 * 356 * @interface NavDestinationInfo 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @crossplatform 359 * @atomicservice 360 * @since 12 361 */ 362 export interface NavDestinationInfo { 363 /** 364 * Navigation id. 365 * 366 * @type { ResourceStr } 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @crossplatform 369 * @since 11 370 */ 371 /** 372 * Navigation id. 373 * 374 * @type { ResourceStr } 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @atomicservice 378 * @since 12 379 */ 380 navigationId: ResourceStr, 381 382 /** 383 * Changed NavDestination name. 384 * 385 * @type { ResourceStr } 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @crossplatform 388 * @since 11 389 */ 390 /** 391 * Changed NavDestination name. 392 * 393 * @type { ResourceStr } 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @crossplatform 396 * @atomicservice 397 * @since 12 398 */ 399 name: ResourceStr, 400 401 /** 402 * Changed NavDestination state. 403 * 404 * @type { NavDestinationState } 405 * @syscap SystemCapability.ArkUI.ArkUI.Full 406 * @crossplatform 407 * @since 11 408 */ 409 /** 410 * Changed NavDestination state. 411 * 412 * @type { NavDestinationState } 413 * @syscap SystemCapability.ArkUI.ArkUI.Full 414 * @crossplatform 415 * @atomicservice 416 * @since 12 417 */ 418 state: NavDestinationState, 419 420 /** 421 * NavDestination index. 422 * 423 * @type { number } 424 * @syscap SystemCapability.ArkUI.ArkUI.Full 425 * @crossplatform 426 * @atomicservice 427 * @since 12 428 */ 429 index: number; 430 431 /** 432 * The detailed parameter of NavDestination. 433 * 434 * @type { ?Object } 435 * @syscap SystemCapability.ArkUI.ArkUI.Full 436 * @crossplatform 437 * @atomicservice 438 * @since 12 439 */ 440 param?: Object; 441 442 /** 443 * Auto-generated navDestination id, which is different from common property id of Component. 444 * 445 * @type { string } 446 * @syscap SystemCapability.ArkUI.ArkUI.Full 447 * @crossplatform 448 * @atomicservice 449 * @since 12 450 */ 451 navDestinationId: string; 452 } 453 454 /** 455 * Navigation info. 456 * 457 * @interface NavigationInfo 458 * @syscap SystemCapability.ArkUI.ArkUI.Full 459 * @crossplatform 460 * @atomicservice 461 * @since 12 462 */ 463 export interface NavigationInfo { 464 /** 465 * Navigation id. 466 * 467 * @type { string } 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @crossplatform 470 * @atomicservice 471 * @since 12 472 */ 473 navigationId: string; 474 475 /** 476 * Navigation path stack. 477 * 478 * @type { NavPathStack } 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @crossplatform 481 * @atomicservice 482 * @since 12 483 */ 484 pathStack: NavPathStack; 485 } 486 487 /** 488 * ScrollEvent info. 489 * 490 * @interface ScrollEventInfo 491 * @syscap SystemCapability.ArkUI.ArkUI.Full 492 * @crossplatform 493 * @atomicservice 494 * @since 12 495 */ 496 export interface ScrollEventInfo { 497 /** 498 * Scroll id. 499 * 500 * @type { string } 501 * @syscap SystemCapability.ArkUI.ArkUI.Full 502 * @crossplatform 503 * @atomicservice 504 * @since 12 505 */ 506 id: string, 507 508 /** 509 * The uniqueId of the scrollable component. 510 * 511 * @type { number } 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @atomicservice 515 * @since 12 516 */ 517 uniqueId: number, 518 519 /** 520 * Changed ScrollEvent type. 521 * 522 * @type { ScrollEventType } 523 * @syscap SystemCapability.ArkUI.ArkUI.Full 524 * @crossplatform 525 * @atomicservice 526 * @since 12 527 */ 528 scrollEvent: ScrollEventType, 529 530 /** 531 * Changed ScrollEvent offset. 532 * 533 * @type { number } 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @crossplatform 536 * @atomicservice 537 * @since 12 538 */ 539 offset: number 540 } 541 542 /** 543 * TabContent info. 544 * 545 * @typedef TabContentInfo 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @atomicservice 549 * @since 12 550 */ 551 export interface TabContentInfo { 552 /** 553 * TabContent id. 554 * 555 * @type { string } 556 * @syscap SystemCapability.ArkUI.ArkUI.Full 557 * @crossplatform 558 * @atomicservice 559 * @since 12 560 */ 561 tabContentId: string, 562 563 /** 564 * TabContent uniqueId. 565 * 566 * @type { number } 567 * @syscap SystemCapability.ArkUI.ArkUI.Full 568 * @crossplatform 569 * @atomicservice 570 * @since 12 571 */ 572 tabContentUniqueId: number, 573 574 /** 575 * The state of TabContent. 576 * 577 * @type { TabContentState } 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @crossplatform 580 * @atomicservice 581 * @since 12 582 */ 583 state: TabContentState, 584 585 /** 586 * The index of TabContent in Tabs. 587 * 588 * @type { number } 589 * @syscap SystemCapability.ArkUI.ArkUI.Full 590 * @crossplatform 591 * @atomicservice 592 * @since 12 593 */ 594 index: number, 595 596 /** 597 * Tabs id. 598 * 599 * @type { string } 600 * @syscap SystemCapability.ArkUI.ArkUI.Full 601 * @crossplatform 602 * @atomicservice 603 * @since 12 604 */ 605 id: string, 606 607 /** 608 * Tabs uniqueId. 609 * 610 * @type { number } 611 * @syscap SystemCapability.ArkUI.ArkUI.Full 612 * @crossplatform 613 * @atomicservice 614 * @since 12 615 */ 616 uniqueId: number 617 } 618 619 /** 620 * observer options. 621 * 622 * @interface ObserverOptions 623 * @syscap SystemCapability.ArkUI.ArkUI.Full 624 * @crossplatform 625 * @atomicservice 626 * @since 12 627 */ 628 export interface ObserverOptions { 629 /** 630 * component id. 631 * 632 * @type { string } 633 * @syscap SystemCapability.ArkUI.ArkUI.Full 634 * @crossplatform 635 * @atomicservice 636 * @since 12 637 */ 638 id: string 639 } 640 641 /** 642 * Router page info. 643 * 644 * @syscap SystemCapability.ArkUI.ArkUI.Full 645 * @crossplatform 646 * @since 11 647 */ 648 /** 649 * Router page info. 650 * 651 * @syscap SystemCapability.ArkUI.ArkUI.Full 652 * @crossplatform 653 * @atomicservice 654 * @since 12 655 */ 656 export class RouterPageInfo { 657 /** 658 * The context of the changed router page. 659 * 660 * @type { UIAbilityContext | UIContext } 661 * @syscap SystemCapability.ArkUI.ArkUI.Full 662 * @crossplatform 663 * @since 11 664 */ 665 /** 666 * The context of the changed router page. 667 * 668 * @type { UIAbilityContext | UIContext } 669 * @syscap SystemCapability.ArkUI.ArkUI.Full 670 * @crossplatform 671 * @atomicservice 672 * @since 12 673 */ 674 context: UIAbilityContext | UIContext; 675 676 /** 677 * The index of the changed router page in router stack. 678 * 679 * @type { number } 680 * @syscap SystemCapability.ArkUI.ArkUI.Full 681 * @crossplatform 682 * @since 11 683 */ 684 /** 685 * The index of the changed router page in router stack. 686 * 687 * @type { number } 688 * @syscap SystemCapability.ArkUI.ArkUI.Full 689 * @crossplatform 690 * @atomicservice 691 * @since 12 692 */ 693 index: number; 694 695 /** 696 * The name of the changed router page. 697 * 698 * @type { string } 699 * @syscap SystemCapability.ArkUI.ArkUI.Full 700 * @crossplatform 701 * @since 11 702 */ 703 /** 704 * The name of the changed router page. 705 * 706 * @type { string } 707 * @syscap SystemCapability.ArkUI.ArkUI.Full 708 * @crossplatform 709 * @atomicservice 710 * @since 12 711 */ 712 name: string; 713 714 /** 715 * The path of the changed router page. 716 * 717 * @type { string } 718 * @syscap SystemCapability.ArkUI.ArkUI.Full 719 * @crossplatform 720 * @since 11 721 */ 722 /** 723 * The path of the changed router page. 724 * 725 * @type { string } 726 * @syscap SystemCapability.ArkUI.ArkUI.Full 727 * @crossplatform 728 * @atomicservice 729 * @since 12 730 */ 731 path: string; 732 733 /** 734 * The state of the changed router page. 735 * 736 * @type { RouterPageState } 737 * @syscap SystemCapability.ArkUI.ArkUI.Full 738 * @crossplatform 739 * @since 11 740 */ 741 /** 742 * The state of the changed router page. 743 * 744 * @type { RouterPageState } 745 * @syscap SystemCapability.ArkUI.ArkUI.Full 746 * @crossplatform 747 * @atomicservice 748 * @since 12 749 */ 750 state: RouterPageState; 751 752 /** 753 * The unique identifier of the router page. 754 * 755 * @type { string } 756 * @syscap SystemCapability.ArkUI.ArkUI.Full 757 * @crossplatform 758 * @atomicservice 759 * @since 12 760 */ 761 pageId: string; 762 } 763 764 /** 765 * Density info. 766 * 767 * @syscap SystemCapability.ArkUI.ArkUI.Full 768 * @crossplatform 769 * @atomicservice 770 * @since 12 771 */ 772 export class DensityInfo { 773 /** 774 * The context of the changed screen density. 775 * 776 * @type { UIContext } 777 * @syscap SystemCapability.ArkUI.ArkUI.Full 778 * @crossplatform 779 * @atomicservice 780 * @since 12 781 */ 782 context: UIContext; 783 784 /** 785 * The changed screen density. 786 * 787 * @type { number } 788 * @syscap SystemCapability.ArkUI.ArkUI.Full 789 * @crossplatform 790 * @atomicservice 791 * @since 12 792 */ 793 density: number; 794 } 795 796 /** 797 * NavDestination switch info 798 * 799 * @interface NavDestinationSwitchInfo 800 * @syscap SystemCapability.ArkUI.ArkUI.Full 801 * @crossplatform 802 * @atomicservice 803 * @since 12 804 */ 805 export interface NavDestinationSwitchInfo { 806 /** 807 * The context of the navigation operation. 808 * 809 * @type { UIAbilityContext | UIContext } 810 * @syscap SystemCapability.ArkUI.ArkUI.Full 811 * @crossplatform 812 * @atomicservice 813 * @since 12 814 */ 815 context: UIAbilityContext | UIContext; 816 817 /** 818 * From navigation content info. 819 * 820 * @type { NavDestinationInfo | NavBar } 821 * @syscap SystemCapability.ArkUI.ArkUI.Full 822 * @crossplatform 823 * @atomicservice 824 * @since 12 825 */ 826 from: NavDestinationInfo | NavBar; 827 828 /** 829 * To navigation content info. 830 * 831 * @type { NavDestinationInfo | NavBar } 832 * @syscap SystemCapability.ArkUI.ArkUI.Full 833 * @crossplatform 834 * @atomicservice 835 * @since 12 836 */ 837 to: NavDestinationInfo | NavBar; 838 839 /** 840 * The operation type. 841 * 842 * @type { NavigationOperation } 843 * @syscap SystemCapability.ArkUI.ArkUI.Full 844 * @crossplatform 845 * @atomicservice 846 * @since 12 847 */ 848 operation: NavigationOperation; 849 } 850 851 /** 852 * Indicates the options of NavDestination switch. 853 * 854 * @interface NavDestinationSwitchObserverOptions 855 * @syscap SystemCapability.ArkUI.ArkUI.Full 856 * @crossplatform 857 * @atomicservice 858 * @since 12 859 */ 860 export interface NavDestinationSwitchObserverOptions { 861 /** 862 * The navigationId that need observation 863 * 864 * @type { ResourceStr } 865 * @syscap SystemCapability.ArkUI.ArkUI.Full 866 * @crossplatform 867 * @atomicservice 868 * @since 12 869 */ 870 navigationId: ResourceStr; 871 } 872 873 /** 874 * Registers a callback function to be called when the navigation destination is updated. 875 * 876 * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. 877 * @param { object } options - The options object. 878 * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated. 879 * @syscap SystemCapability.ArkUI.ArkUI.Full 880 * @crossplatform 881 * @since 11 882 */ 883 /** 884 * Registers a callback function to be called when the navigation destination is updated. 885 * 886 * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. 887 * @param { object } options - The options object. 888 * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated. 889 * @syscap SystemCapability.ArkUI.ArkUI.Full 890 * @crossplatform 891 * @atomicservice 892 * @since 12 893 */ 894 export function on(type: 'navDestinationUpdate', options: { navigationId: ResourceStr }, callback: Callback<NavDestinationInfo>): void; 895 896 /** 897 * Removes a callback function that was previously registered with `on()`. 898 * 899 * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. 900 * @param { object } options - The options object. 901 * @param { Callback<NavDestinationInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and 902 * navigation ID will be removed. 903 * @syscap SystemCapability.ArkUI.ArkUI.Full 904 * @crossplatform 905 * @since 11 906 */ 907 /** 908 * Removes a callback function that was previously registered with `on()`. 909 * 910 * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. 911 * @param { object } options - The options object. 912 * @param { Callback<NavDestinationInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and 913 * navigation ID will be removed. 914 * @syscap SystemCapability.ArkUI.ArkUI.Full 915 * @crossplatform 916 * @atomicservice 917 * @since 12 918 */ 919 export function off(type: 'navDestinationUpdate', options: { navigationId: ResourceStr }, callback?: Callback<NavDestinationInfo>): void; 920 921 /** 922 * Registers a callback function to be called when the navigation destination is updated. 923 * 924 * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. 925 * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated. 926 * @syscap SystemCapability.ArkUI.ArkUI.Full 927 * @crossplatform 928 * @since 11 929 */ 930 /** 931 * Registers a callback function to be called when the navigation destination is updated. 932 * 933 * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. 934 * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated. 935 * @syscap SystemCapability.ArkUI.ArkUI.Full 936 * @crossplatform 937 * @atomicservice 938 * @since 12 939 */ 940 export function on(type: 'navDestinationUpdate', callback: Callback<NavDestinationInfo>): void; 941 942 /** 943 * Removes a callback function that was previously registered with `on()`. 944 * 945 * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. 946 * @param { Callback<NavDestinationInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 947 * will be removed. 948 * @syscap SystemCapability.ArkUI.ArkUI.Full 949 * @crossplatform 950 * @since 11 951 */ 952 /** 953 * Removes a callback function that was previously registered with `on()`. 954 * 955 * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. 956 * @param { Callback<NavDestinationInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 957 * will be removed. 958 * @syscap SystemCapability.ArkUI.ArkUI.Full 959 * @crossplatform 960 * @atomicservice 961 * @since 12 962 */ 963 export function off(type: 'navDestinationUpdate', callback?: Callback<NavDestinationInfo>): void; 964 965 /** 966 * Registers a callback function to be called when the scroll event start or stop. 967 * 968 * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. 969 * @param { ObserverOptions } options - The options object. 970 * @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop. 971 * @syscap SystemCapability.ArkUI.ArkUI.Full 972 * @crossplatform 973 * @atomicservice 974 * @since 12 975 */ 976 export function on(type: 'scrollEvent', options: ObserverOptions, callback: Callback<ScrollEventInfo>): void; 977 978 /** 979 * Removes a callback function that was previously registered with `on()`. 980 * 981 * @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'. 982 * @param { ObserverOptions } options - The options object. 983 * @param { Callback<ScrollEventInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and 984 * scroll ID will be removed. 985 * @syscap SystemCapability.ArkUI.ArkUI.Full 986 * @crossplatform 987 * @atomicservice 988 * @since 12 989 */ 990 export function off(type: 'scrollEvent', options: ObserverOptions, callback?: Callback<ScrollEventInfo>): void; 991 992 /** 993 * Registers a callback function to be called when the scroll event start or stop. 994 * 995 * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. 996 * @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop. 997 * @syscap SystemCapability.ArkUI.ArkUI.Full 998 * @crossplatform 999 * @atomicservice 1000 * @since 12 1001 */ 1002 export function on(type: 'scrollEvent', callback: Callback<ScrollEventInfo>): void; 1003 1004 /** 1005 * Removes a callback function that was previously registered with `on()`. 1006 * 1007 * @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'. 1008 * @param { Callback<ScrollEventInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1009 * will be removed. 1010 * @syscap SystemCapability.ArkUI.ArkUI.Full 1011 * @crossplatform 1012 * @atomicservice 1013 * @since 12 1014 */ 1015 export function off(type: 'scrollEvent', callback?: Callback<ScrollEventInfo>): void; 1016 1017 /** 1018 * Registers a callback function to be called when the router page is updated. 1019 * 1020 * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. 1021 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1022 * @param { Callback<RouterPageInfo> } callback - The callback function to be called when the router page is updated. 1023 * @syscap SystemCapability.ArkUI.ArkUI.Full 1024 * @crossplatform 1025 * @since 11 1026 */ 1027 /** 1028 * Registers a callback function to be called when the router page is updated. 1029 * 1030 * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. 1031 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1032 * @param { Callback<RouterPageInfo> } callback - The callback function to be called when the router page is updated. 1033 * @syscap SystemCapability.ArkUI.ArkUI.Full 1034 * @crossplatform 1035 * @atomicservice 1036 * @since 12 1037 */ 1038 export function on(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback: Callback<RouterPageInfo>): void; 1039 1040 /** 1041 * Removes a callback function that was previously registered with `on()`. 1042 * 1043 * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. 1044 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1045 * @param { Callback<RouterPageInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1046 * will be removed. 1047 * @syscap SystemCapability.ArkUI.ArkUI.Full 1048 * @crossplatform 1049 * @since 11 1050 */ 1051 /** 1052 * Removes a callback function that was previously registered with `on()`. 1053 * 1054 * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. 1055 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1056 * @param { Callback<RouterPageInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1057 * will be removed. 1058 * @syscap SystemCapability.ArkUI.ArkUI.Full 1059 * @crossplatform 1060 * @atomicservice 1061 * @since 12 1062 */ 1063 export function off(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback?: Callback<RouterPageInfo>): void; 1064 1065 /** 1066 * Registers a callback function to be called when the screen density is updated. 1067 * 1068 * @param { 'densityUpdate' } type - The type of event to listen for. Must be 'densityUpdate'. 1069 * @param { UIContext } context - The context scope of the observer. 1070 * @param { Callback<DensityInfo> } callback - The callback function to be called when the screen density is updated. 1071 * @syscap SystemCapability.ArkUI.ArkUI.Full 1072 * @crossplatform 1073 * @atomicservice 1074 * @since 12 1075 */ 1076 export function on(type: 'densityUpdate', context: UIContext, callback: Callback<DensityInfo>): void; 1077 1078 /** 1079 * Removes a callback function that was previously registered with `on()`. 1080 * 1081 * @param { 'densityUpdate' } type - The type of event to remove the listener for. Must be 'densityUpdate'. 1082 * @param { UIContext } context - The context scope of the observer. 1083 * @param { Callback<DensityInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1084 * will be removed. 1085 * @syscap SystemCapability.ArkUI.ArkUI.Full 1086 * @crossplatform 1087 * @atomicservice 1088 * @since 12 1089 */ 1090 export function off(type: 'densityUpdate', context: UIContext, callback?: Callback<DensityInfo>): void; 1091 1092 /** 1093 * Registers a callback function to be called when the draw command will be drawn. 1094 * 1095 * @param { 'willDraw' } type - The type of event to listen for. Must be 'willDraw'. 1096 * @param { UIContext } context - The context scope of the observer. 1097 * @param { Callback<void> } callback - The callback function to be called when the draw command will be drawn. 1098 * @syscap SystemCapability.ArkUI.ArkUI.Full 1099 * @crossplatform 1100 * @atomicservice 1101 * @since 12 1102 */ 1103 export function on(type: 'willDraw', context: UIContext, callback: Callback<void>): void; 1104 1105 /** 1106 * Removes a callback function that was previously registered with `on()`. 1107 * 1108 * @param { 'willDraw' } type - The type of event to remove the listener for. Must be 'willDraw'. 1109 * @param { UIContext } context - The context scope of the observer. 1110 * @param { Callback<void> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1111 * will be removed. 1112 * @syscap SystemCapability.ArkUI.ArkUI.Full 1113 * @crossplatform 1114 * @atomicservice 1115 * @since 12 1116 */ 1117 export function off(type: 'willDraw', context: UIContext, callback?: Callback<void>): void; 1118 1119 /** 1120 * Registers a callback function to be called when the layout is done. 1121 * 1122 * @param { 'didLayout' } type - The type of event to listen for. Must be 'didLayout'. 1123 * @param { UIContext } context - The context scope of the observer. 1124 * @param { Callback<void> } callback - The callback function to be called when the layout is done. 1125 * @syscap SystemCapability.ArkUI.ArkUI.Full 1126 * @crossplatform 1127 * @atomicservice 1128 * @since 12 1129 */ 1130 export function on(type: 'didLayout', context: UIContext, callback: Callback<void>): void; 1131 1132 /** 1133 * Removes a callback function that was previously registered with `on()`. 1134 * 1135 * @param { 'didLayout' } type - The type of event to remove the listener for. Must be 'didLayout'. 1136 * @param { UIContext } context - The context scope of the observer. 1137 * @param { Callback<void> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1138 * will be removed. 1139 * @syscap SystemCapability.ArkUI.ArkUI.Full 1140 * @crossplatform 1141 * @atomicservice 1142 * @since 12 1143 */ 1144 export function off(type: 'didLayout', context: UIContext, callback?: Callback<void>): void; 1145 1146 /** 1147 * Registers a callback function to be called when the tabContent is showed or hidden. 1148 * 1149 * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'. 1150 * @param { ObserverOptions } options - The options object. 1151 * @param { Callback<TabContentInfo> } callback - The callback function to be called when when the tabContent is showed or hidden. 1152 * @syscap SystemCapability.ArkUI.ArkUI.Full 1153 * @crossplatform 1154 * @atomicservice 1155 * @since 12 1156 */ 1157 export function on(type: 'tabContentUpdate', options: ObserverOptions, callback: Callback<TabContentInfo>): void; 1158 1159 /** 1160 * Removes a callback function that was previously registered with `on()`. 1161 * 1162 * @param { 'tabContentUpdate' } type - The type of event to remove the listener for. Must be 'tabContentUpdate'. 1163 * @param { ObserverOptions } options - The options object. 1164 * @param { Callback<TabContentInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and 1165 * Tabs ID will be removed. 1166 * @syscap SystemCapability.ArkUI.ArkUI.Full 1167 * @crossplatform 1168 * @atomicservice 1169 * @since 12 1170 */ 1171 export function off(type: 'tabContentUpdate', options: ObserverOptions, callback?: Callback<TabContentInfo>): void; 1172 1173 /** 1174 * Registers a callback function to be called when the tabContent is showed or hidden. 1175 * 1176 * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'. 1177 * @param { Callback<TabContentInfo> } callback - The callback function to be called when the tabContent is showed or hidden. 1178 * @syscap SystemCapability.ArkUI.ArkUI.Full 1179 * @crossplatform 1180 * @atomicservice 1181 * @since 12 1182 */ 1183 export function on(type: 'tabContentUpdate', callback: Callback<TabContentInfo>): void; 1184 1185 /** 1186 * Removes a callback function that was previously registered with `on()`. 1187 * 1188 * @param { 'tabContentUpdate'} type - The type of event to remove the listener for. Must be 'tabContentUpdate'. 1189 * @param { Callback<TabContentInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1190 * will be removed. 1191 * @syscap SystemCapability.ArkUI.ArkUI.Full 1192 * @crossplatform 1193 * @atomicservice 1194 * @since 12 1195 */ 1196 export function off(type: 'tabContentUpdate', callback?: Callback<TabContentInfo>): void; 1197 1198 /** 1199 * Registers a callback function to be called when the navigation switched to a new navDestination. 1200 * 1201 * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. 1202 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1203 * @param { Callback<NavDestinationSwitchInfo> } callback - The callback function to be called when the navigation switched to a new navDestination. 1204 * @syscap SystemCapability.ArkUI.ArkUI.Full 1205 * @crossplatform 1206 * @atomicservice 1207 * @since 12 1208 */ 1209 export function on( 1210 type: 'navDestinationSwitch', 1211 context: UIAbilityContext | UIContext, 1212 callback: Callback<NavDestinationSwitchInfo> 1213 ): void; 1214 1215 /** 1216 * Removes a callback function that was previously registered with `on()`. 1217 * 1218 * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. 1219 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1220 * @param { Callback<NavDestinationSwitchInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1221 * will be removed. 1222 * @syscap SystemCapability.ArkUI.ArkUI.Full 1223 * @crossplatform 1224 * @atomicservice 1225 * @since 12 1226 */ 1227 export function off( 1228 type: 'navDestinationSwitch', 1229 context: UIAbilityContext | UIContext, 1230 callback?: Callback<NavDestinationSwitchInfo> 1231 ): void; 1232 1233 /** 1234 * Registers a callback function to be called when the navigation switched to a new navDestination. 1235 * 1236 * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. 1237 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1238 * @param { NavDestinationSwitchObserverOptions } observerOptions - Options. 1239 * @param { Callback<NavDestinationSwitchInfo> } callback - The callback function to be called when the navigation switched to a new navDestination. 1240 * @syscap SystemCapability.ArkUI.ArkUI.Full 1241 * @crossplatform 1242 * @atomicservice 1243 * @since 12 1244 */ 1245 export function on( 1246 type: 'navDestinationSwitch', 1247 context: UIAbilityContext | UIContext, 1248 observerOptions: NavDestinationSwitchObserverOptions, 1249 callback: Callback<NavDestinationSwitchInfo> 1250 ): void; 1251 1252 /** 1253 * Removes a callback function that was previously registered with `on()`. 1254 * 1255 * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. 1256 * @param { UIAbilityContext | UIContext } context - The context scope of the observer. 1257 * @param { NavDestinationSwitchObserverOptions } observerOptions - Options. 1258 * @param { Callback<NavDestinationSwitchInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type 1259 * will be removed. 1260 * @syscap SystemCapability.ArkUI.ArkUI.Full 1261 * @crossplatform 1262 * @atomicservice 1263 * @since 12 1264 */ 1265 export function off( 1266 type: 'navDestinationSwitch', 1267 context: UIAbilityContext | UIContext, 1268 observerOptions: NavDestinationSwitchObserverOptions, 1269 callback?: Callback<NavDestinationSwitchInfo> 1270 ): void; 1271} 1272 1273export default uiObserver; 1274