• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     * NavDestination mode.
455     *
456     * @type { NavDestinationMode }
457     * @syscap SystemCapability.ArkUI.ArkUI.Full
458     * @crossplatform
459     * @atomicservice
460     * @since 15
461     */
462    mode?: NavDestinationMode;
463
464    /**
465     * NavDestination uniqueId.
466     *
467     * @type { number }
468     * @syscap SystemCapability.ArkUI.ArkUI.Full
469     * @crossplatform
470     * @atomicservice
471     * @since 15
472     */
473    uniqueId?: number;
474  }
475
476  /**
477   * Navigation info.
478   *
479   * @interface NavigationInfo
480   * @syscap SystemCapability.ArkUI.ArkUI.Full
481   * @crossplatform
482   * @atomicservice
483   * @since 12
484   */
485  export interface NavigationInfo {
486    /**
487     * Navigation id.
488     *
489     * @type { string }
490     * @syscap SystemCapability.ArkUI.ArkUI.Full
491     * @crossplatform
492     * @atomicservice
493     * @since 12
494     */
495    navigationId: string;
496
497    /**
498     * Navigation path stack.
499     *
500     * @type { NavPathStack }
501     * @syscap SystemCapability.ArkUI.ArkUI.Full
502     * @crossplatform
503     * @atomicservice
504     * @since 12
505     */
506    pathStack: NavPathStack;
507  }
508
509  /**
510   * ScrollEvent info.
511   *
512   * @interface ScrollEventInfo
513   * @syscap SystemCapability.ArkUI.ArkUI.Full
514   * @crossplatform
515   * @atomicservice
516   * @since 12
517   */
518  export interface ScrollEventInfo {
519    /**
520     * Scroll id.
521     *
522     * @type { string }
523     * @syscap SystemCapability.ArkUI.ArkUI.Full
524     * @crossplatform
525     * @atomicservice
526     * @since 12
527     */
528    id: string,
529
530    /**
531     * The uniqueId of the scrollable component.
532     *
533     * @type { number }
534     * @syscap SystemCapability.ArkUI.ArkUI.Full
535     * @crossplatform
536     * @atomicservice
537     * @since 12
538     */
539    uniqueId: number,
540
541    /**
542     * Changed ScrollEvent type.
543     *
544     * @type { ScrollEventType }
545     * @syscap SystemCapability.ArkUI.ArkUI.Full
546     * @crossplatform
547     * @atomicservice
548     * @since 12
549     */
550    scrollEvent: ScrollEventType,
551
552    /**
553     * Changed ScrollEvent offset.
554     *
555     * @type { number }
556     * @syscap SystemCapability.ArkUI.ArkUI.Full
557     * @crossplatform
558     * @atomicservice
559     * @since 12
560     */
561    offset: number
562  }
563
564  /**
565   * TabContent info.
566   *
567   * @typedef TabContentInfo
568   * @syscap SystemCapability.ArkUI.ArkUI.Full
569   * @crossplatform
570   * @atomicservice
571   * @since 12
572   */
573  export interface TabContentInfo {
574    /**
575     * TabContent id.
576     *
577     * @type { string }
578     * @syscap SystemCapability.ArkUI.ArkUI.Full
579     * @crossplatform
580     * @atomicservice
581     * @since 12
582     */
583    tabContentId: string,
584
585    /**
586     * TabContent uniqueId.
587     *
588     * @type { number }
589     * @syscap SystemCapability.ArkUI.ArkUI.Full
590     * @crossplatform
591     * @atomicservice
592     * @since 12
593     */
594    tabContentUniqueId: number,
595
596    /**
597     * The state of TabContent.
598     *
599     * @type { TabContentState }
600     * @syscap SystemCapability.ArkUI.ArkUI.Full
601     * @crossplatform
602     * @atomicservice
603     * @since 12
604     */
605    state: TabContentState,
606
607    /**
608     * The index of TabContent in Tabs.
609     *
610     * @type { number }
611     * @syscap SystemCapability.ArkUI.ArkUI.Full
612     * @crossplatform
613     * @atomicservice
614     * @since 12
615     */
616    index: number,
617
618    /**
619     * Tabs id.
620     *
621     * @type { string }
622     * @syscap SystemCapability.ArkUI.ArkUI.Full
623     * @crossplatform
624     * @atomicservice
625     * @since 12
626     */
627    id: string,
628
629    /**
630     * Tabs uniqueId.
631     *
632     * @type { number }
633     * @syscap SystemCapability.ArkUI.ArkUI.Full
634     * @crossplatform
635     * @atomicservice
636     * @since 12
637     */
638    uniqueId: number
639  }
640
641    /**
642     * observer options.
643     *
644     * @interface ObserverOptions
645     * @syscap SystemCapability.ArkUI.ArkUI.Full
646     * @crossplatform
647     * @atomicservice
648     * @since 12
649     */
650    export interface ObserverOptions {
651      /**
652       * component id.
653       *
654       * @type { string }
655       * @syscap SystemCapability.ArkUI.ArkUI.Full
656       * @crossplatform
657       * @atomicservice
658       * @since 12
659       */
660      id: string
661    }
662
663  /**
664   * Router page info.
665   *
666   * @syscap SystemCapability.ArkUI.ArkUI.Full
667   * @crossplatform
668   * @since 11
669   */
670  /**
671   * Router page info.
672   *
673   * @syscap SystemCapability.ArkUI.ArkUI.Full
674   * @crossplatform
675   * @atomicservice
676   * @since 12
677   */
678  export class RouterPageInfo {
679    /**
680     * The context of the changed router page.
681     *
682     * @type { UIAbilityContext | UIContext }
683     * @syscap SystemCapability.ArkUI.ArkUI.Full
684     * @crossplatform
685     * @since 11
686     */
687    /**
688     * The context of the changed router page.
689     *
690     * @type { UIAbilityContext | UIContext }
691     * @syscap SystemCapability.ArkUI.ArkUI.Full
692     * @crossplatform
693     * @atomicservice
694     * @since 12
695     */
696    context: UIAbilityContext | UIContext;
697
698    /**
699     * The index of the changed router page in router stack.
700     *
701     * @type { number }
702     * @syscap SystemCapability.ArkUI.ArkUI.Full
703     * @crossplatform
704     * @since 11
705     */
706    /**
707     * The index of the changed router page in router stack.
708     *
709     * @type { number }
710     * @syscap SystemCapability.ArkUI.ArkUI.Full
711     * @crossplatform
712     * @atomicservice
713     * @since 12
714     */
715    index: number;
716
717    /**
718     * The name of the changed router page.
719     *
720     * @type { string }
721     * @syscap SystemCapability.ArkUI.ArkUI.Full
722     * @crossplatform
723     * @since 11
724     */
725    /**
726     * The name of the changed router page.
727     *
728     * @type { string }
729     * @syscap SystemCapability.ArkUI.ArkUI.Full
730     * @crossplatform
731     * @atomicservice
732     * @since 12
733     */
734    name: string;
735
736    /**
737     * The path of the changed router page.
738     *
739     * @type { string }
740     * @syscap SystemCapability.ArkUI.ArkUI.Full
741     * @crossplatform
742     * @since 11
743     */
744    /**
745     * The path of the changed router page.
746     *
747     * @type { string }
748     * @syscap SystemCapability.ArkUI.ArkUI.Full
749     * @crossplatform
750     * @atomicservice
751     * @since 12
752     */
753    path: string;
754
755    /**
756     * The state of the changed router page.
757     *
758     * @type { RouterPageState }
759     * @syscap SystemCapability.ArkUI.ArkUI.Full
760     * @crossplatform
761     * @since 11
762     */
763    /**
764     * The state of the changed router page.
765     *
766     * @type { RouterPageState }
767     * @syscap SystemCapability.ArkUI.ArkUI.Full
768     * @crossplatform
769     * @atomicservice
770     * @since 12
771     */
772    state: RouterPageState;
773
774    /**
775     * The unique identifier of the router page.
776     *
777     * @type { string }
778     * @syscap SystemCapability.ArkUI.ArkUI.Full
779     * @crossplatform
780     * @atomicservice
781     * @since 12
782     */
783     pageId: string;
784  }
785
786  /**
787   * Density info.
788   *
789   * @syscap SystemCapability.ArkUI.ArkUI.Full
790   * @crossplatform
791   * @atomicservice
792   * @since 12
793   */
794  export class DensityInfo {
795    /**
796     * The context of the changed screen density.
797     *
798     * @type { UIContext }
799     * @syscap SystemCapability.ArkUI.ArkUI.Full
800     * @crossplatform
801     * @atomicservice
802     * @since 12
803     */
804    context: UIContext;
805
806    /**
807     * The changed screen density.
808     *
809     * @type { number }
810     * @syscap SystemCapability.ArkUI.ArkUI.Full
811     * @crossplatform
812     * @atomicservice
813     * @since 12
814     */
815    density: number;
816  }
817
818  /**
819   * NavDestination switch info
820   *
821   * @interface NavDestinationSwitchInfo
822   * @syscap SystemCapability.ArkUI.ArkUI.Full
823   * @crossplatform
824   * @atomicservice
825   * @since 12
826   */
827  export interface NavDestinationSwitchInfo {
828    /**
829     * The context of the navigation operation.
830     *
831     * @type { UIAbilityContext | UIContext }
832     * @syscap SystemCapability.ArkUI.ArkUI.Full
833     * @crossplatform
834     * @atomicservice
835     * @since 12
836     */
837    context: UIAbilityContext | UIContext;
838
839    /**
840     * From navigation content info.
841     *
842     * @type { NavDestinationInfo | NavBar }
843     * @syscap SystemCapability.ArkUI.ArkUI.Full
844     * @crossplatform
845     * @atomicservice
846     * @since 12
847     */
848    from: NavDestinationInfo | NavBar;
849
850    /**
851     * To navigation content info.
852     *
853     * @type { NavDestinationInfo | NavBar }
854     * @syscap SystemCapability.ArkUI.ArkUI.Full
855     * @crossplatform
856     * @atomicservice
857     * @since 12
858     */
859    to: NavDestinationInfo | NavBar;
860
861    /**
862     * The operation type.
863     *
864     * @type { NavigationOperation }
865     * @syscap SystemCapability.ArkUI.ArkUI.Full
866     * @crossplatform
867     * @atomicservice
868     * @since 12
869     */
870    operation: NavigationOperation;
871  }
872
873  /**
874   * Indicates the options of NavDestination switch.
875   *
876   * @interface NavDestinationSwitchObserverOptions
877   * @syscap SystemCapability.ArkUI.ArkUI.Full
878   * @crossplatform
879   * @atomicservice
880   * @since 12
881   */
882  export interface NavDestinationSwitchObserverOptions {
883    /**
884     * The navigationId that need observation
885     *
886     * @type { ResourceStr }
887     * @syscap SystemCapability.ArkUI.ArkUI.Full
888     * @crossplatform
889     * @atomicservice
890     * @since 12
891     */
892    navigationId: ResourceStr;
893  }
894
895  /**
896   * Registers a callback function to be called when the navigation destination is updated.
897   *
898   * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'.
899   * @param { object } options - The options object.
900   * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated.
901   * @syscap SystemCapability.ArkUI.ArkUI.Full
902   * @crossplatform
903   * @since 11
904   */
905  /**
906   * Registers a callback function to be called when the navigation destination is updated.
907   *
908   * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'.
909   * @param { object } options - The options object.
910   * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated.
911   * @syscap SystemCapability.ArkUI.ArkUI.Full
912   * @crossplatform
913   * @atomicservice
914   * @since 12
915   */
916  export function on(type: 'navDestinationUpdate', options: { navigationId: ResourceStr }, callback: Callback<NavDestinationInfo>): void;
917
918  /**
919   * Removes a callback function that was previously registered with `on()`.
920   *
921   * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'.
922   * @param { object } options - The options object.
923   * @param { Callback<NavDestinationInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
924   *                                                    navigation ID will be removed.
925   * @syscap SystemCapability.ArkUI.ArkUI.Full
926   * @crossplatform
927   * @since 11
928   */
929  /**
930   * Removes a callback function that was previously registered with `on()`.
931   *
932   * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'.
933   * @param { object } options - The options object.
934   * @param { Callback<NavDestinationInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
935   *                                                    navigation ID will be removed.
936   * @syscap SystemCapability.ArkUI.ArkUI.Full
937   * @crossplatform
938   * @atomicservice
939   * @since 12
940   */
941  export function off(type: 'navDestinationUpdate', options: { navigationId: ResourceStr }, callback?: Callback<NavDestinationInfo>): void;
942
943  /**
944   * Registers a callback function to be called when the navigation destination is updated.
945   *
946   * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'.
947   * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated.
948   * @syscap SystemCapability.ArkUI.ArkUI.Full
949   * @crossplatform
950   * @since 11
951   */
952  /**
953   * Registers a callback function to be called when the navigation destination is updated.
954   *
955   * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'.
956   * @param { Callback<NavDestinationInfo> } callback - The callback function to be called when the navigation destination is updated.
957   * @syscap SystemCapability.ArkUI.ArkUI.Full
958   * @crossplatform
959   * @atomicservice
960   * @since 12
961   */
962  export function on(type: 'navDestinationUpdate', callback: Callback<NavDestinationInfo>): void;
963
964  /**
965   * Removes a callback function that was previously registered with `on()`.
966   *
967   * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'.
968   * @param { Callback<NavDestinationInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
969   *                                                      will be removed.
970   * @syscap SystemCapability.ArkUI.ArkUI.Full
971   * @crossplatform
972   * @since 11
973   */
974  /**
975   * Removes a callback function that was previously registered with `on()`.
976   *
977   * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'.
978   * @param { Callback<NavDestinationInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
979   *                                                      will be removed.
980   * @syscap SystemCapability.ArkUI.ArkUI.Full
981   * @crossplatform
982   * @atomicservice
983   * @since 12
984   */
985  export function off(type: 'navDestinationUpdate', callback?: Callback<NavDestinationInfo>): void;
986
987  /**
988   * Registers a callback function to be called when the scroll event start or stop.
989   *
990   * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
991   * @param { ObserverOptions } options - The options object.
992   * @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
993   * @syscap SystemCapability.ArkUI.ArkUI.Full
994   * @crossplatform
995   * @atomicservice
996   * @since 12
997   */
998  export function on(type: 'scrollEvent', options: ObserverOptions, callback: Callback<ScrollEventInfo>): void;
999
1000  /**
1001   * Removes a callback function that was previously registered with `on()`.
1002   *
1003   * @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'.
1004   * @param { ObserverOptions } options - The options object.
1005   * @param { Callback<ScrollEventInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
1006   *                                                    scroll ID will be removed.
1007   * @syscap SystemCapability.ArkUI.ArkUI.Full
1008   * @crossplatform
1009   * @atomicservice
1010   * @since 12
1011   */
1012  export function off(type: 'scrollEvent', options: ObserverOptions, callback?: Callback<ScrollEventInfo>): void;
1013
1014  /**
1015   * Registers a callback function to be called when the scroll event start or stop.
1016   *
1017   * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'.
1018   * @param { Callback<ScrollEventInfo> } callback - The callback function to be called when the scroll event start or stop.
1019   * @syscap SystemCapability.ArkUI.ArkUI.Full
1020   * @crossplatform
1021   * @atomicservice
1022   * @since 12
1023   */
1024  export function on(type: 'scrollEvent', callback: Callback<ScrollEventInfo>): void;
1025
1026  /**
1027   * Removes a callback function that was previously registered with `on()`.
1028   *
1029   * @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'.
1030   * @param { Callback<ScrollEventInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1031   *                                                      will be removed.
1032   * @syscap SystemCapability.ArkUI.ArkUI.Full
1033   * @crossplatform
1034   * @atomicservice
1035   * @since 12
1036   */
1037  export function off(type: 'scrollEvent', callback?: Callback<ScrollEventInfo>): void;
1038
1039  /**
1040   * Registers a callback function to be called when the router page is updated.
1041   *
1042   * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'.
1043   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1044   * @param { Callback<RouterPageInfo> } callback - The callback function to be called when the router page is updated.
1045   * @syscap SystemCapability.ArkUI.ArkUI.Full
1046   * @crossplatform
1047   * @since 11
1048   */
1049  /**
1050   * Registers a callback function to be called when the router page is updated.
1051   *
1052   * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'.
1053   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1054   * @param { Callback<RouterPageInfo> } callback - The callback function to be called when the router page is updated.
1055   * @syscap SystemCapability.ArkUI.ArkUI.Full
1056   * @crossplatform
1057   * @atomicservice
1058   * @since 12
1059   */
1060  export function on(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback: Callback<RouterPageInfo>): void;
1061
1062  /**
1063   * Removes a callback function that was previously registered with `on()`.
1064   *
1065   * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'.
1066   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1067   * @param { Callback<RouterPageInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1068   *                                                               will be removed.
1069   * @syscap SystemCapability.ArkUI.ArkUI.Full
1070   * @crossplatform
1071   * @since 11
1072   */
1073  /**
1074   * Removes a callback function that was previously registered with `on()`.
1075   *
1076   * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'.
1077   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1078   * @param { Callback<RouterPageInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1079   *                                                               will be removed.
1080   * @syscap SystemCapability.ArkUI.ArkUI.Full
1081   * @crossplatform
1082   * @atomicservice
1083   * @since 12
1084   */
1085  export function off(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback?: Callback<RouterPageInfo>): void;
1086
1087  /**
1088   * Registers a callback function to be called when the screen density is updated.
1089   *
1090   * @param { 'densityUpdate' } type - The type of event to listen for. Must be 'densityUpdate'.
1091   * @param { UIContext } context - The context scope of the observer.
1092   * @param { Callback<DensityInfo> } callback - The callback function to be called when the screen density is updated.
1093   * @syscap SystemCapability.ArkUI.ArkUI.Full
1094   * @crossplatform
1095   * @atomicservice
1096   * @since 12
1097   */
1098  export function on(type: 'densityUpdate', context: UIContext, callback: Callback<DensityInfo>): void;
1099
1100  /**
1101   * Removes a callback function that was previously registered with `on()`.
1102   *
1103   * @param { 'densityUpdate' } type - The type of event to remove the listener for. Must be 'densityUpdate'.
1104   * @param { UIContext } context - The context scope of the observer.
1105   * @param { Callback<DensityInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1106   *                                               will be removed.
1107   * @syscap SystemCapability.ArkUI.ArkUI.Full
1108   * @crossplatform
1109   * @atomicservice
1110   * @since 12
1111   */
1112  export function off(type: 'densityUpdate', context: UIContext, callback?: Callback<DensityInfo>): void;
1113
1114  /**
1115   * Registers a callback function to be called when the draw command will be drawn.
1116   *
1117   * @param { 'willDraw' } type - The type of event to listen for. Must be 'willDraw'.
1118   * @param { UIContext } context - The context scope of the observer.
1119   * @param { Callback<void> } callback - The callback function to be called when the draw command will be drawn.
1120   * @syscap SystemCapability.ArkUI.ArkUI.Full
1121   * @crossplatform
1122   * @atomicservice
1123   * @since 12
1124   */
1125  export function on(type: 'willDraw', context: UIContext, callback: Callback<void>): void;
1126
1127  /**
1128   * Removes a callback function that was previously registered with `on()`.
1129   *
1130   * @param { 'willDraw' } type - The type of event to remove the listener for. Must be 'willDraw'.
1131   * @param { UIContext } context - The context scope of the observer.
1132   * @param { Callback<void> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1133   *                                               will be removed.
1134   * @syscap SystemCapability.ArkUI.ArkUI.Full
1135   * @crossplatform
1136   * @atomicservice
1137   * @since 12
1138   */
1139  export function off(type: 'willDraw', context: UIContext, callback?: Callback<void>): void;
1140
1141  /**
1142   * Registers a callback function to be called when the layout is done.
1143   *
1144   * @param { 'didLayout' } type - The type of event to listen for. Must be 'didLayout'.
1145   * @param { UIContext } context - The context scope of the observer.
1146   * @param { Callback<void> } callback - The callback function to be called when the layout is done.
1147   * @syscap SystemCapability.ArkUI.ArkUI.Full
1148   * @crossplatform
1149   * @atomicservice
1150   * @since 12
1151   */
1152  export function on(type: 'didLayout', context: UIContext, callback: Callback<void>): void;
1153
1154  /**
1155   * Removes a callback function that was previously registered with `on()`.
1156   *
1157   * @param { 'didLayout' } type - The type of event to remove the listener for. Must be 'didLayout'.
1158   * @param { UIContext } context - The context scope of the observer.
1159   * @param { Callback<void> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1160   *                                               will be removed.
1161   * @syscap SystemCapability.ArkUI.ArkUI.Full
1162   * @crossplatform
1163   * @atomicservice
1164   * @since 12
1165   */
1166  export function off(type: 'didLayout', context: UIContext, callback?: Callback<void>): void;
1167
1168  /**
1169   * Registers a callback function to be called when the tabContent is showed or hidden.
1170   *
1171   * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
1172   * @param { ObserverOptions } options - The options object.
1173   * @param { Callback<TabContentInfo> } callback - The callback function to be called when when the tabContent is showed or hidden.
1174   * @syscap SystemCapability.ArkUI.ArkUI.Full
1175   * @crossplatform
1176   * @atomicservice
1177   * @since 12
1178   */
1179  export function on(type: 'tabContentUpdate', options: ObserverOptions, callback: Callback<TabContentInfo>): void;
1180
1181  /**
1182   * Removes a callback function that was previously registered with `on()`.
1183   *
1184   * @param { 'tabContentUpdate' } type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
1185   * @param { ObserverOptions } options - The options object.
1186   * @param { Callback<TabContentInfo> } callback - The callback function to remove. If not provided, all callbacks for the given event type and
1187   *                                                    Tabs ID will be removed.
1188   * @syscap SystemCapability.ArkUI.ArkUI.Full
1189   * @crossplatform
1190   * @atomicservice
1191   * @since 12
1192   */
1193  export function off(type: 'tabContentUpdate', options: ObserverOptions, callback?: Callback<TabContentInfo>): void;
1194
1195  /**
1196   * Registers a callback function to be called when the tabContent is showed or hidden.
1197   *
1198   * @param { 'tabContentUpdate' } type - The type of event to listen for. Must be 'tabContentUpdate'.
1199   * @param { Callback<TabContentInfo> } callback - The callback function to be called when the tabContent is showed or hidden.
1200   * @syscap SystemCapability.ArkUI.ArkUI.Full
1201   * @crossplatform
1202   * @atomicservice
1203   * @since 12
1204   */
1205  export function on(type: 'tabContentUpdate', callback: Callback<TabContentInfo>): void;
1206
1207  /**
1208   * Removes a callback function that was previously registered with `on()`.
1209   *
1210   * @param { 'tabContentUpdate'} type - The type of event to remove the listener for. Must be 'tabContentUpdate'.
1211   * @param { Callback<TabContentInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1212   *                                                      will be removed.
1213   * @syscap SystemCapability.ArkUI.ArkUI.Full
1214   * @crossplatform
1215   * @atomicservice
1216   * @since 12
1217   */
1218  export function off(type: 'tabContentUpdate', callback?: Callback<TabContentInfo>): void;
1219
1220  /**
1221   * Registers a callback function to be called when the navigation switched to a new navDestination.
1222   *
1223   * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'.
1224   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1225   * @param { Callback<NavDestinationSwitchInfo> } callback - The callback function to be called when the navigation switched to a new navDestination.
1226   * @syscap SystemCapability.ArkUI.ArkUI.Full
1227   * @crossplatform
1228   * @atomicservice
1229   * @since 12
1230   */
1231  export function on(
1232    type: 'navDestinationSwitch',
1233    context: UIAbilityContext | UIContext,
1234    callback: Callback<NavDestinationSwitchInfo>
1235  ): void;
1236
1237  /**
1238   * Removes a callback function that was previously registered with `on()`.
1239   *
1240   * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'.
1241   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1242   * @param { Callback<NavDestinationSwitchInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1243   *                                                               will be removed.
1244   * @syscap SystemCapability.ArkUI.ArkUI.Full
1245   * @crossplatform
1246   * @atomicservice
1247   * @since 12
1248   */
1249  export function off(
1250    type: 'navDestinationSwitch',
1251    context: UIAbilityContext | UIContext,
1252    callback?: Callback<NavDestinationSwitchInfo>
1253  ): void;
1254
1255  /**
1256   * Registers a callback function to be called when the navigation switched to a new navDestination.
1257   *
1258   * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'.
1259   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1260   * @param { NavDestinationSwitchObserverOptions } observerOptions - Options.
1261   * @param { Callback<NavDestinationSwitchInfo> } callback - The callback function to be called when the navigation switched to a new navDestination.
1262   * @syscap SystemCapability.ArkUI.ArkUI.Full
1263   * @crossplatform
1264   * @atomicservice
1265   * @since 12
1266   */
1267  export function on(
1268    type: 'navDestinationSwitch',
1269    context: UIAbilityContext | UIContext,
1270    observerOptions: NavDestinationSwitchObserverOptions,
1271    callback: Callback<NavDestinationSwitchInfo>
1272  ): void;
1273
1274  /**
1275   * Removes a callback function that was previously registered with `on()`.
1276   *
1277   * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'.
1278   * @param { UIAbilityContext | UIContext } context - The context scope of the observer.
1279   * @param { NavDestinationSwitchObserverOptions } observerOptions - Options.
1280   * @param { Callback<NavDestinationSwitchInfo> } [callback] - The callback function to remove. If not provided, all callbacks for the given event type
1281   *                                                               will be removed.
1282   * @syscap SystemCapability.ArkUI.ArkUI.Full
1283   * @crossplatform
1284   * @atomicservice
1285   * @since 12
1286   */
1287  export function off(
1288    type: 'navDestinationSwitch',
1289    context: UIAbilityContext | UIContext,
1290    observerOptions: NavDestinationSwitchObserverOptions,
1291    callback?: Callback<NavDestinationSwitchInfo>
1292  ): void;
1293}
1294
1295export default uiObserver;
1296