> 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.
> 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.
Deletes a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, and the Widget Manager will not retain the widget information.
Deletes a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, and the Widget Manager will not retain the widget information.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formId | string | Yes | ID of a widget.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Deletes a widget. This API uses a promise to return the result. After this API is called, the application can no longer use the widget, and the Widget Manager will not retain the widget information.
Deletes a widget. This API uses a promise to return the result. After this API is called, the application can no longer use the widget, and the Widget Manager will not retain the widget information.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formId | string | Yes | ID of a widget.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
Releases a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager still retains the widget cache and storage information.
Releases a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager still retains the widget cache and storage information.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formId | string | Yes | ID of a widget.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Releases a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager retains the storage information about the widget and determines whether to retain the cache information based on the setting.
Releases a widget. This API uses an asynchronous callback to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager retains the storage information about the widget and retains or releases the cache information based on the setting.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- |
| -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. |
| formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | Yes | Whether to release the cache.|
| isReleaseCache | boolean | Yes | Whether to release the cache.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Releases a widget. This API uses a promise to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager retains the storage information about the widget and determines whether to retain the cache information based on the setting.
Releases a widget. This API uses a promise to return the result. After this API is called, the application can no longer use the widget, but the Widget Manager retains the storage information about the widget and retains or releases the cache information based on the setting.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name | Type | Mandatory| Description |
| Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | ----------- |
| -------------- | ------ | ---- | ----------- |
| formId | string | Yes | ID of a widget. |
| formId | string | Yes | ID of a widget. |
| isReleaseCache | boolean | No | Whether to release the cache.|
| isReleaseCache | boolean | No | Whether to release the cache.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
Instructs the widget framework to make a widget visible. This API uses an asynchronous callback to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
Instructs the widget framework to make a widget visible. This API uses an asynchronous callback to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Instructs the widget framework to make a widget visible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
Instructs the widget framework to make a widget visible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
Instructs the widget framework to make a widget invisible. This API uses an asynchronous callback to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
Instructs the widget framework to make a widget invisible. This API uses an asynchronous callback to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Instructs the widget framework to make a widget invisible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
Instructs the widget framework to make a widget invisible. This API uses a promise to return the result. After this API is called, **onVisibilityChange** is invoked to notify the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
Instructs the widget framework to make a widget to be updatable. This API uses an asynchronous callback to return the result. After this API is called, the widget is in the enabled state and can receive updates from the widget provider.
Instructs the widget framework to make a widget updatable. This API uses an asynchronous callback to return the result. After this API is called, the widget is in the enabled state and can receive updates from the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Instructs the widget framework to make a widget to be updatable. This API uses a promise to return the result. After this API is called, the widget is in the enabled state and can receive updates from the widget provider.
Instructs the widget framework to make a widget updatable. This API uses a promise to return the result. After this API is called, the widget is in the enabled state and can receive updates from the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
Instructs the widget framework to make a widget not to be updatable. This API uses an asynchronous callback to return the result. After this API is called, the widget is in the disabled state and cannot receive updates from the widget provider.
Instructs the widget framework to make a widget not updatable. This API uses an asynchronous callback to return the result. After this API is called, the widget cannot receive updates from the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs. |
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
Instructs the widget framework to make a widget not to be updatable. This API uses a promise to return the result. After this API is called, the widget is in the disabled state and cannot receive updates from the widget provider.
Instructs the widget framework to make a widget not updatable. This API uses a promise to return the result. After this API is called, the widget cannot receive updates from the widget provider.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formId | string | Yes | ID of a widget.|
| formIds | Array<string> | Yes | List of widget IDs.|
**Return value**
**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
| type | string | Yes | Type of event to unsubscribe from. The value **formUninstall** indicates a widget uninstallation event.|
| type | string | Yes | Type of event to subscribe to. The value **formUninstall** indicates a widget uninstallation event.|
| callback | Callback<string> | Yes| Callback used to return the result.|
| callback | Callback<string> | No| Callback used for event unsubscription. If it is left unspecified, it indicates the callback for all the events that have been subscribed.|
**Example**
**Example**
```js
```js
formHost.off("formUninstall",(error,data)=>{
letcallback=function(formId){
if(error){
console.log('formHost on formUninstall, formId:'+formId);
console.log('formHost off formUninstall, error:'+error.code);
}
}
formHost.off("formUninstall",callback);
});
```
```
## notifyFormsVisible
## notifyFormsVisible
...
@@ -893,25 +927,25 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: A
...
@@ -893,25 +927,25 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: A
Instructs the widgets to make themselves visible. This API uses an asynchronous callback to return the result.
Instructs the widgets to make themselves visible. This API uses an asynchronous callback to return the result.
**System capability**:
**System capability**
SystemCapability.Ability.Form
SystemCapability.Ability.Form
**Parameters**
**Parameters**
| Name| Type | Mandatory| Description |
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------- |
| ------ | ------ | ---- | ------- |
| formIds | Array<string> | Yes | List of widget IDs.|
| formIds | Array<string> | Yes | List of widget IDs.|
| isVisible | boolean | Yes | Whether to be visible.|
| isVisible | boolean | Yes | Whether to be visible.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
| callback | AsyncCallback<void> | Yes| Callback used to return the result.|