diff --git a/en/application-dev/reference/apis/js-apis-formhost.md b/en/application-dev/reference/apis/js-apis-formhost.md index 0c01c3bcbca95cfd5fd9b2b5c42f06faa1b83fbb..bd087eda8196a134a5ecbfbbecaaf47a6af9bfa1 100644 --- a/en/application-dev/reference/apis/js-apis-formhost.md +++ b/en/application-dev/reference/apis/js-apis-formhost.md @@ -1,6 +1,6 @@ # FormHost -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to the widget host. @@ -57,15 +57,15 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | formId | string | Yes | ID of a widget.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| formId | string | Yes | ID of a widget.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Parameters** @@ -147,16 +147,16 @@ SystemCapability.Ability.Form **Parameters** - | Name | Type | Mandatory| Description | - | -------------- | ------ | ---- | ----------- | - | formId | string | Yes | ID of a widget. | - | isReleaseCache | boolean | No | Whether to release the cache.| +| Name | Type | Mandatory| Description | +| -------------- | ------ | ---- | ----------- | +| formId | string | Yes | ID of a widget. | +| isReleaseCache | boolean | No | Whether to release the cache.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -209,15 +209,15 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | formId | string | Yes | ID of a widget.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| formId | string | Yes | ID of a widget.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -270,15 +270,15 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | formId | string | Yes | ID of a widget.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| formId | string | Yes | ID of a widget.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -337,9 +337,9 @@ SystemCapability.Ability.Form **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -398,9 +398,9 @@ SystemCapability.Ability.Form **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -459,9 +459,9 @@ SystemCapability.Ability.Form **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -520,9 +520,9 @@ SystemCapability.Ability.Form **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -574,9 +574,9 @@ SystemCapability.Ability.Form **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -601,9 +601,9 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -655,10 +655,10 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | bundleName | string | Yes| Bundle name of the target application.| - | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| bundleName | string | Yes| Bundle name of the target application.| +| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -684,11 +684,11 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | bundleName | string | Yes| Bundle name of the target application.| - | moduleName | string | Yes| Module name.| - | callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| bundleName | string | Yes| Bundle name of the target application.| +| moduleName | string | Yes| Module name.| +| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.| **Example** @@ -714,10 +714,10 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | bundleName | string | Yes| Bundle name of the target application.| - | moduleName | string | No| Module name.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| bundleName | string | Yes| Bundle name of the target application.| +| moduleName | string | No| Module name.| **Return value** @@ -962,16 +962,16 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | formIds | Array<string> | Yes | List of widget IDs.| - | isVisible | boolean | Yes | Whether to be visible.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| formIds | Array<string> | Yes | List of widget IDs.| +| isVisible | boolean | Yes | Whether to be visible.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** @@ -1025,16 +1025,16 @@ SystemCapability.Ability.Form **Parameters** - | Name| Type | Mandatory| Description | - | ------ | ------ | ---- | ------- | - | formIds | Array<string> | Yes | List of widget IDs.| - | isEnableUpdate | boolean | Yes | Whether to enable update.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------- | +| formIds | Array<string> | Yes | List of widget IDs.| +| isEnableUpdate | boolean | Yes | Whether to enable update.| **Return value** - | Type| Description| - | -------- | -------- | - | Promise<void> | Promise used to return the result indicating whether the API is successfully called.| +| Type| Description| +| -------- | -------- | +| Promise<void> | Promise used to return the result indicating whether the API is successfully called.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md index 40367d50bcec160ec9d2bf932f3d8c6275a86d5f..e48d4ada58ae469c73c71b6f90ae682610544706 100644 --- a/en/application-dev/reference/apis/js-apis-formprovider.md +++ b/en/application-dev/reference/apis/js-apis-formprovider.md @@ -1,6 +1,6 @@ # FormProvider -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE**
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. Provides APIs related to the widget provider. @@ -38,8 +38,8 @@ SystemCapability.Ability.Form ```js var formId = "12400633174999288"; formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { - if (error) { - console.log('formProvider setFormNextRefreshTime, error:' + error.code); + if (error.code) { + console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); } }); ``` @@ -71,7 +71,9 @@ SystemCapability.Ability.Form ```js var formId = "12400633174999288"; - formProvider.setFormNextRefreshTime(formId, 5).catch((error) => { + formProvider.setFormNextRefreshTime(formId, 5).then(() => { + console.log('formProvider setFormNextRefreshTime success'); + }).catch((error) => { console.log('formProvider setFormNextRefreshTime, error:' + JSON.stringify(error)); }); ``` @@ -101,8 +103,8 @@ SystemCapability.Ability.Form var formId = "12400633174999288"; let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); formProvider.updateForm(formId, obj, (error, data) => { - if (error) { - console.log('formProvider updateForm, error:' + error.code); + if (error.code) { + console.log('formProvider updateForm, error:' + JSON.stringify(error)); } }); ``` @@ -136,7 +138,9 @@ SystemCapability.Ability.Form import formBindingData from '@ohos.application.formBindingData'; var formId = "12400633174999288"; let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"}); - formProvider.updateForm(formId, obj).catch((error) => { + formProvider.updateForm(formId, obj).then(() => { + console.log('formProvider updateForm success'); + }).catch((error) => { console.log('formProvider updateForm, error:' + JSON.stringify(error)); }); ```