• 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 FormKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import { Callback } from './@ohos.base';
23import formInfo from './@ohos.app.form.formInfo';
24
25/**
26 * Interface of formObserver.
27 *
28 * @namespace formObserver
29 * @syscap SystemCapability.Ability.Form
30 * @systemapi
31 * @since 10
32 */
33declare namespace formObserver {
34  /**
35   * Listens to the event of add form.
36   * <p>You can use this method to listen to the event of add form.</p>
37   *
38   * @permission ohos.permission.OBSERVE_FORM_RUNNING
39   * @param { 'formAdd' } type - Indicates event type.
40   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
41   *                                                                  form info.
42   * @throws { BusinessError } 202 - The application is not a system application.
43   * @throws { BusinessError } 401 - Parameter error. Possible causes:
44   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
45   * @syscap SystemCapability.Ability.Form
46   * @systemapi
47   * @since 10
48   */
49  function on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>): void;
50
51  /**
52   * Listens to the event of add form.
53   * <p>You can use this method to listen to the event of add form for a particular card host.</p>
54   *
55   * @permission ohos.permission.OBSERVE_FORM_RUNNING
56   * @param { 'formAdd' } type - Indicates event type.
57   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
58   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
59   *                                                                  form info.
60   * @throws { BusinessError } 202 - The application is not a system application.
61   * @throws { BusinessError } 401 - Parameter error. Possible causes:
62   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
63   * @syscap SystemCapability.Ability.Form
64   * @systemapi
65   * @since 10
66   */
67  function on(type: 'formAdd', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
68
69  /**
70   * Cancels listening to the event of add form.
71   * <p>You can use this method to cancel listening to the event of add form.</p>
72   *
73   * @permission ohos.permission.OBSERVE_FORM_RUNNING
74   * @param { 'formAdd' } type - Indicates event type.
75   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
76   * @param { Callback<formInfo.RunningFormInfo> } [observerCallback] - The callback is used to return the running
77   *                                                                    form info.
78   * @throws { BusinessError } 202 - The application is not a system application.
79   * @throws { BusinessError } 401 - Parameter error. Possible causes:
80   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
81   * @syscap SystemCapability.Ability.Form
82   * @systemapi
83   * @since 10
84   */
85  function off(type: 'formAdd', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
86
87  /**
88   * Listens to the event of remove form.
89   * <p>You can use this method to listen to the event of remove form.</p>
90   *
91   * @permission ohos.permission.OBSERVE_FORM_RUNNING
92   * @param { 'formRemove' } type - Indicates event type.
93   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
94   *                                                                  form info.
95   * @throws { BusinessError } 202 - The application is not a system application.
96   * @throws { BusinessError } 401 - Parameter error. Possible causes:
97   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
98   * @syscap SystemCapability.Ability.Form
99   * @systemapi
100   * @since 10
101   */
102  function on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>): void;
103
104  /**
105   * Listens to the event of remove form.
106   * <p>You can use this method to listen to the event of remove form for a particular card host.</p>
107   *
108   * @permission ohos.permission.OBSERVE_FORM_RUNNING
109   * @param { 'formRemove' } type - Indicates event type.
110   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
111   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
112   *                                                                  form info.
113   * @throws { BusinessError } 202 - The application is not a system application.
114   * @throws { BusinessError } 401 - Parameter error. Possible causes:
115   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
116   * @syscap SystemCapability.Ability.Form
117   * @systemapi
118   * @since 10
119   */
120  function on(type: 'formRemove', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
121
122  /**
123   * Cancels listening to the event of remove form.
124   * <p>You can use this method to cancel listening to the event of remove form.</p>
125   *
126   * @permission ohos.permission.OBSERVE_FORM_RUNNING
127   * @param { 'formRemove' } type - Indicates event type.
128   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
129   * @param { Callback<formInfo.RunningFormInfo> } [observerCallback] - The callback is used to return the running
130   *                                                                    form info.
131   * @throws { BusinessError } 202 - The application is not a system application.
132   * @throws { BusinessError } 401 - Parameter error. Possible causes:
133   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
134   * @syscap SystemCapability.Ability.Form
135   * @systemapi
136   * @since 10
137   */
138  function off(type: 'formRemove', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
139
140  /**
141   * Listens to the event of notifyVisible type change.
142   * <p>You can use this method to listen to the event of notifyVisible type change.</p>
143   *
144   * @permission ohos.permission.OBSERVE_FORM_RUNNING
145   * @param { 'notifyVisible' } type - Indicates event type.
146   * @param { Callback<Array<formInfo.RunningFormInfo>> } observerCallback - The callback is used to return
147   *                                                                         the running form info.
148   * @throws { BusinessError } 202 - The application is not a system application.
149   * @throws { BusinessError } 401 - Parameter error. Possible causes:
150   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
151   * @syscap SystemCapability.Ability.Form
152   * @systemapi
153   * @since 10
154   */
155  function on(type: 'notifyVisible', observerCallback: Callback<Array<formInfo.RunningFormInfo>>): void;
156
157  /**
158   * Listens to the event of notifyVisible type change.
159   * <p>You can use this method to listen to the event of notifyVisible type change for a particular card host.</p>
160   *
161   * @permission ohos.permission.OBSERVE_FORM_RUNNING
162   * @param { 'notifyVisible' } type - Indicates event type.
163   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
164   * @param { Callback<Array<formInfo.RunningFormInfo>> } observerCallback - The callback is used to return
165   *                                                                         the running form info.
166   * @throws { BusinessError } 202 - The application is not a system application.
167   * @throws { BusinessError } 401 - Parameter error. Possible causes:
168   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
169   * @syscap SystemCapability.Ability.Form
170   * @systemapi
171   * @since 10
172   */
173  function on(
174    type: 'notifyVisible',
175    hostBundleName: string,
176    observerCallback: Callback<Array<formInfo.RunningFormInfo>>
177  ): void;
178
179  /**
180   * Listens to the event of notifyInvisible type change.
181   * <p>You can use this method to listen to the event of notifyInvisible type change.</p>
182   *
183   * @permission ohos.permission.OBSERVE_FORM_RUNNING
184   * @param { 'notifyInvisible' } type - Indicates event type.
185   * @param { Callback<Array<formInfo.RunningFormInfo>> } observerCallback - The callback is used to return
186   *                                                                         the running form info.
187   * @throws { BusinessError } 202 - The application is not a system application.
188   * @throws { BusinessError } 401 - Parameter error. Possible causes:
189   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
190   * @syscap SystemCapability.Ability.Form
191   * @systemapi
192   * @since 10
193   */
194  function on(type: 'notifyInvisible', observerCallback: Callback<Array<formInfo.RunningFormInfo>>): void;
195
196  /**
197   * Listens to the event of notifyInvisible type change.
198   * <p>You can use this method to listen to the event of notifyInvisible type change for a particular card host.</p>
199   *
200   * @permission ohos.permission.OBSERVE_FORM_RUNNING
201   * @param { 'notifyInvisible' } type - Indicates event type.
202   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
203   * @param { Callback<Array<formInfo.RunningFormInfo>> } observerCallback - The callback is used to return
204   *                                                                         the running form info.
205   * @throws { BusinessError } 202 - The application is not a system application.
206   * @throws { BusinessError } 401 - Parameter error. Possible causes:
207   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
208   * @syscap SystemCapability.Ability.Form
209   * @systemapi
210   * @since 10
211   */
212  function on(
213    type: 'notifyInvisible',
214    hostBundleName: string,
215    observerCallback: Callback<Array<formInfo.RunningFormInfo>>,
216  ): void;
217
218  /**
219   * Cancels listening to the event of notifyVisible type change.
220   * <p>You can use this method to cancel listening to the event of notifyVisible type change.</p>
221   *
222   * @permission ohos.permission.OBSERVE_FORM_RUNNING
223   * @param { 'notifyVisible' } type - Indicates event type.
224   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
225   * @param { Callback<Array<formInfo.RunningFormInfo>> } [observerCallback] - The callback is used to return
226   *                                                                  the running form info.
227   * @throws { BusinessError } 202 - The application is not a system application.
228   * @throws { BusinessError } 401 - Parameter error. Possible causes:
229   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
230   * @syscap SystemCapability.Ability.Form
231   * @systemapi
232   * @since 10
233   */
234  function off(
235    type: 'notifyVisible',
236    hostBundleName?: string,
237    observerCallback?: Callback<Array<formInfo.RunningFormInfo>>
238  ): void;
239
240  /**
241   * Cancels listening to the event of notifyInvisible type change.
242   * <p>You can use this method to cancel listening to the event of notifyInvisible type change.</p>
243   *
244   * @permission ohos.permission.OBSERVE_FORM_RUNNING
245   * @param { 'notifyInvisible' } type - Indicates event type.
246   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
247   * @param { Callback<Array<formInfo.RunningFormInfo>> } [observerCallback] - The callback is used to return
248   *                                                                         the running form info.
249   * @throws { BusinessError } 202 - The application is not a system application.
250   * @throws { BusinessError } 401 - Parameter error. Possible causes:
251   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
252   * @syscap SystemCapability.Ability.Form
253   * @systemapi
254   * @since 10
255   */
256  function off(
257    type: 'notifyInvisible',
258    hostBundleName?: string,
259    observerCallback?: Callback<Array<formInfo.RunningFormInfo>>
260  ): void;
261
262  /**
263   * Obtains the RunningFormInfo objects provided by a specific card host application on the device.
264   *
265   * @permission ohos.permission.OBSERVE_FORM_RUNNING
266   * @param { AsyncCallback<Array<formInfo.RunningFormInfo>> } callback - The callback is used to return the
267   *                                                                      RunningFormInfo.
268   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
269   * @throws { BusinessError } 201 - Permissions denied.
270   * @throws { BusinessError } 202 - The application is not a system application.
271   * @throws { BusinessError } 401 - Parameter error. Possible causes:
272   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
273   * @throws { BusinessError } 16500050 - IPC connection error.
274   * @throws { BusinessError } 16500060 - Service connection error.
275   * @syscap SystemCapability.Ability.Form
276   * @systemapi
277   * @since 10
278   */
279  function getRunningFormInfos(callback: AsyncCallback<Array<formInfo.RunningFormInfo>>, hostBundleName?: string): void;
280
281  /**
282   * Obtains the RunningFormInfo objects provided by a specific card host application on the device.
283   *
284   * @permission ohos.permission.OBSERVE_FORM_RUNNING
285   * @param { AsyncCallback<Array<formInfo.RunningFormInfo>> } callback - The callback is used to return the
286   *                                                                      RunningFormInfo.
287   * @param { boolean } isUnusedIncluded - Indicates whether to include unused form.
288   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
289   * @throws { BusinessError } 201 - Permissions denied.
290   * @throws { BusinessError } 202 - The application is not a system application.
291   * @throws { BusinessError } 401 - Parameter error. Possible causes:
292   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
293   * @throws { BusinessError } 16500050 - IPC connection error.
294   * @throws { BusinessError } 16500060 - Service connection error.
295   * @syscap SystemCapability.Ability.Form
296   * @systemapi
297   * @since 11
298   */
299  function getRunningFormInfos(
300    callback: AsyncCallback<Array<formInfo.RunningFormInfo>>,
301    isUnusedIncluded: boolean,
302    hostBundleName?: string
303  ): void;
304
305  /**
306   * Obtains the RunningFormInfo objects provided by a specific card host application on the device.
307   *
308   * @permission ohos.permission.OBSERVE_FORM_RUNNING
309   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
310   * @returns { Promise<Array<formInfo.RunningFormInfo>> } Returns the RunningFormInfo.
311   * @throws { BusinessError } 201 - Permissions denied.
312   * @throws { BusinessError } 202 - The application is not a system application.
313   * @throws { BusinessError } 401 - Parameter error. Possible causes:
314   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
315   * @throws { BusinessError } 16500050 - IPC connection error.
316   * @throws { BusinessError } 16500060 - Service connection error.
317   * @syscap SystemCapability.Ability.Form
318   * @systemapi
319   * @since 10
320   */
321  function getRunningFormInfos(hostBundleName?: string): Promise<Array<formInfo.RunningFormInfo>>;
322
323  /**
324   * Obtains the RunningFormInfo objects provided by a specific card host application on the device.
325   *
326   * @permission ohos.permission.OBSERVE_FORM_RUNNING
327   * @param { boolean } isUnusedIncluded - Indicates whether to include unused form.
328   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
329   * @returns { Promise<Array<formInfo.RunningFormInfo>> } Returns the RunningFormInfo.
330   * @throws { BusinessError } 201 - Permissions denied.
331   * @throws { BusinessError } 202 - The application is not a system application.
332   * @throws { BusinessError } 401 - Parameter error. Possible causes:
333   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
334   * @throws { BusinessError } 16500050 - IPC connection error.
335   * @throws { BusinessError } 16500060 - Service connection error.
336   * @syscap SystemCapability.Ability.Form
337   * @systemapi
338   * @since 11
339   */
340  function getRunningFormInfos(
341    isUnusedIncluded: boolean,
342    hostBundleName?: string
343  ): Promise<Array<formInfo.RunningFormInfo>>;
344
345  /**
346   * Obtains the RunningFormInfo objects by FormProviderFilter.
347   *
348   * @permission ohos.permission.OBSERVE_FORM_RUNNING
349   * @param { formInfo.FormProviderFilter } formProviderFilter - Indicates the form provider app info.
350   * @returns { Promise<Array<formInfo.RunningFormInfo>> } The promise returned by the function.
351   * @throws { BusinessError } 201 - Permissions denied.
352   * @throws { BusinessError } 202 - The application is not a system application.
353   * @throws { BusinessError } 401 - Parameter error. Possible causes:
354   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
355   * @throws { BusinessError } 16500050 - IPC connection error.
356   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
357   * @throws { BusinessError } 16501000 - An internal functional error occurred.
358   * @syscap SystemCapability.Ability.Form
359   * @systemapi
360   * @stagemodelonly
361   * @since 10
362   */
363  function getRunningFormInfosByFilter(
364    formProviderFilter: formInfo.FormProviderFilter
365  ): Promise<Array<formInfo.RunningFormInfo>>;
366
367  /**
368   * Obtains the RunningFormInfo objects by FormProviderFilter.
369   *
370   * @permission ohos.permission.OBSERVE_FORM_RUNNING
371   * @param { formInfo.FormProviderFilter } formProviderFilter - Indicates the form provider app info.
372   * @param { AsyncCallback<Array<formInfo.RunningFormInfo>> } callback - The callback of getFormInstancesByFilter.
373   * @throws { BusinessError } 201 - Permissions denied.
374   * @throws { BusinessError } 202 - The application is not a system application.
375   * @throws { BusinessError } 401 - Parameter error. Possible causes:
376   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
377   * @throws { BusinessError } 16500050 - IPC connection error.
378   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
379   * @throws { BusinessError } 16501000 - An internal functional error occurred.
380   * @syscap SystemCapability.Ability.Form
381   * @systemapi
382   * @stagemodelonly
383   * @since 10
384   */
385  function getRunningFormInfosByFilter(
386    formProviderFilter: formInfo.FormProviderFilter,
387    callback: AsyncCallback<Array<formInfo.RunningFormInfo>>
388  ): void;
389
390  /**
391   * Obtains the RunningFormInfo object by formId.
392   *
393   * @permission ohos.permission.OBSERVE_FORM_RUNNING
394   * @param { string } formId - Indicates the form provider formId.
395   * @returns { Promise<formInfo.RunningFormInfo> } The promise returned by the function.
396   * @throws { BusinessError } 201 - Permissions denied.
397   * @throws { BusinessError } 202 - The application is not a system application.
398   * @throws { BusinessError } 401 - Parameter error. Possible causes:
399   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
400   * @throws { BusinessError } 16500050 - IPC connection error.
401   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
402   * @throws { BusinessError } 16501000 - An internal functional error occurred.
403   * @syscap SystemCapability.Ability.Form
404   * @systemapi
405   * @stagemodelonly
406   * @since 10
407   */
408  function getRunningFormInfoById(formId: string): Promise<formInfo.RunningFormInfo>;
409
410  /**
411   * Obtains the RunningFormInfo object by formId.
412   *
413   * @permission ohos.permission.OBSERVE_FORM_RUNNING
414   * @param { string } formId - Indicates the form provider formId.
415   * @param { boolean } isUnusedIncluded - Indicates whether to include unused form.
416   * @returns { Promise<formInfo.RunningFormInfo> } The promise returned by the function.
417   * @throws { BusinessError } 201 - Permissions denied.
418   * @throws { BusinessError } 202 - The application is not a system application.
419   * @throws { BusinessError } 401 - Parameter error. Possible causes:
420   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
421   * @throws { BusinessError } 16500050 - IPC connection error.
422   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
423   * @throws { BusinessError } 16501000 - An internal functional error occurred.
424   * @syscap SystemCapability.Ability.Form
425   * @systemapi
426   * @stagemodelonly
427   * @since 11
428   */
429  function getRunningFormInfoById(formId: string, isUnusedIncluded: boolean): Promise<formInfo.RunningFormInfo>;
430
431  /**
432   * Obtains the RunningFormInfo object by formId.
433   *
434   * @permission ohos.permission.OBSERVE_FORM_RUNNING
435   * @param { string } formId - Indicates the form provider formId.
436   * @param { AsyncCallback<formInfo.RunningFormInfo> } callback - The callback of getFormInstancesById.
437   * @throws { BusinessError } 201 - Permissions denied.
438   * @throws { BusinessError } 202 - The application is not a system application.
439   * @throws { BusinessError } 401 - Parameter error. Possible causes:
440   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
441   * @throws { BusinessError } 16500050 - IPC connection error.
442   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
443   * @throws { BusinessError } 16501000 - An internal functional error occurred.
444   * @syscap SystemCapability.Ability.Form
445   * @systemapi
446   * @stagemodelonly
447   * @since 10
448   */
449  function getRunningFormInfoById(formId: string, callback: AsyncCallback<formInfo.RunningFormInfo>): void;
450
451  /**
452   * Obtains the RunningFormInfo object by formId.
453   *
454   * @permission ohos.permission.OBSERVE_FORM_RUNNING
455   * @param { string } formId - Indicates the form provider formId.
456   * @param { boolean } isUnusedIncluded - Indicates whether to include unused form.
457   * @param { AsyncCallback<formInfo.RunningFormInfo> } callback - The callback of getFormInstancesById.
458   * @throws { BusinessError } 201 - Permissions denied.
459   * @throws { BusinessError } 202 - The application is not a system application.
460   * @throws { BusinessError } 401 - Parameter error. Possible causes:
461   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
462   * @throws { BusinessError } 16500050 - IPC connection error.
463   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
464   * @throws { BusinessError } 16501000 - An internal functional error occurred.
465   * @syscap SystemCapability.Ability.Form
466   * @systemapi
467   * @stagemodelonly
468   * @since 11
469   */
470  function getRunningFormInfoById(
471    formId: string,
472    isUnusedIncluded: boolean,
473    callback: AsyncCallback<formInfo.RunningFormInfo>
474  ): void;
475
476  /**
477   * Router event listening in registered form.
478   * <p>This interface requires permission to receive callback.</p>
479   *
480   * @permission ohos.permission.OBSERVE_FORM_RUNNING
481   * @param { 'router' } type - Indicates event type.
482   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
483   *                                                                  form info.
484   * @throws { BusinessError } 202 - The application is not a system application.
485   * @throws { BusinessError } 401 - Parameter error. Possible causes:
486   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
487   * @syscap SystemCapability.Ability.Form
488   * @systemapi
489   * @since 11
490   */
491  function on(type: 'router', observerCallback: Callback<formInfo.RunningFormInfo>): void;
492
493  /**
494   * Router event listening in registered form.
495   * <p>This interface requires permission to receive callback.</p>
496   *
497   * @permission ohos.permission.OBSERVE_FORM_RUNNING
498   * @param { 'router' } type - Indicates event type.
499   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
500   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
501   *                                                                  form info.
502   * @throws { BusinessError } 202 - The application is not a system application.
503   * @throws { BusinessError } 401 - Parameter error. Possible causes:
504   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
505   * @syscap SystemCapability.Ability.Form
506   * @systemapi
507   * @since 11
508   */
509  function on(type: 'router', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
510
511  /**
512   * Unregister form router event Listening.
513   *
514   * @permission ohos.permission.OBSERVE_FORM_RUNNING
515   * @param { 'router' } type - Indicates event type.
516   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
517   * @param { Callback<formInfo.RunningFormInfo> } [observerCallback] - The callback is used to return the running
518   *                                                                    form info.
519   * @throws { BusinessError } 202 - The application is not a system application.
520   * @throws { BusinessError } 401 - Parameter error. Possible causes:
521   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
522   * @syscap SystemCapability.Ability.Form
523   * @systemapi
524   * @since 11
525   */
526  function off(type: 'router', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
527
528  /**
529   * Message event listening in registered form.
530   * <p>This interface requires permission to receive callback.</p>
531   *
532   * @permission ohos.permission.OBSERVE_FORM_RUNNING
533   * @param { 'message' } type - Indicates event type.
534   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
535   *                                                                  form info.
536   * @throws { BusinessError } 202 - The application is not a system application.
537   * @throws { BusinessError } 401 - Parameter error. Possible causes:
538   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
539   * @syscap SystemCapability.Ability.Form
540   * @systemapi
541   * @since 11
542   */
543  function on(type: 'message', observerCallback: Callback<formInfo.RunningFormInfo>): void;
544
545  /**
546   * Message event listening in registered form.
547   * <p>This interface requires permission to receive callback.</p>
548   *
549   * @permission ohos.permission.OBSERVE_FORM_RUNNING
550   * @param { 'message' } type - Indicates event type.
551   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
552   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
553   *                                                                  form info.
554   * @throws { BusinessError } 202 - The application is not a system application.
555   * @throws { BusinessError } 401 - Parameter error. Possible causes:
556   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
557   * @syscap SystemCapability.Ability.Form
558   * @systemapi
559   * @since 11
560   */
561  function on(type: 'message', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
562
563  /**
564   * Unregister form message event Listening.
565   *
566   * @permission ohos.permission.OBSERVE_FORM_RUNNING
567   * @param { 'message' } type - Indicates event type.
568   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
569   * @param { Callback<formInfo.RunningFormInfo> } [observerCallback] - The callback is used to return the running
570   *                                                                    form info.
571   * @throws { BusinessError } 202 - The application is not a system application.
572   * @throws { BusinessError } 401 - Parameter error. Possible causes:
573   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
574   * @syscap SystemCapability.Ability.Form
575   * @systemapi
576   * @since 11
577   */
578  function off(type: 'message', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
579
580  /**
581   * Call event listening in registered form.
582   * <p>This interface requires permission to receive callback.</p>
583   *
584   * @permission ohos.permission.OBSERVE_FORM_RUNNING
585   * @param { 'call' } type - Indicates event type.
586   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
587   *                                                                  form info.
588   * @throws { BusinessError } 202 - The application is not a system application.
589   * @throws { BusinessError } 401 - Parameter error. Possible causes:
590   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
591   * @syscap SystemCapability.Ability.Form
592   * @systemapi
593   * @since 11
594   */
595  function on(type: 'call', observerCallback: Callback<formInfo.RunningFormInfo>): void;
596
597  /**
598   * Call event listening in registered form.
599   * <p>This interface requires permission to receive callback.</p>
600   *
601   * @permission ohos.permission.OBSERVE_FORM_RUNNING
602   * @param { 'call' } type - Indicates event type.
603   * @param { string } hostBundleName - Indicates the bundle name of the form host application.
604   * @param { Callback<formInfo.RunningFormInfo> } observerCallback - The callback is used to return the running
605   *                                                                  form info.
606   * @throws { BusinessError } 202 - The application is not a system application.
607   * @throws { BusinessError } 401 - Parameter error. Possible causes:
608   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
609   * @syscap SystemCapability.Ability.Form
610   * @systemapi
611   * @since 11
612   */
613  function on(type: 'call', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
614
615  /**
616   * Unregister form call event Listening.
617   *
618   * @permission ohos.permission.OBSERVE_FORM_RUNNING
619   * @param { 'call' } type - Indicates event type.
620   * @param { string } [hostBundleName] - Indicates the bundle name of the form host application.
621   * @param { Callback<formInfo.RunningFormInfo> } [observerCallback] - The callback is used to return the running
622   *                                                                    form info.
623   * @throws { BusinessError } 202 - The application is not a system application.
624   * @throws { BusinessError } 401 - Parameter error. Possible causes:
625   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
626   * @syscap SystemCapability.Ability.Form
627   * @systemapi
628   * @since 11
629   */
630  function off(type: 'call', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
631}
632export default formObserver;
633