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