diff --git a/en/application-dev/ability/stage-formextension.md b/en/application-dev/ability/stage-formextension.md index 9bdce67b2ce4eef4825079e6cf07086280b85466..1d8a6620392ae992785f48ae0c6d0b117a3250bb 100644 --- a/en/application-dev/ability/stage-formextension.md +++ b/en/application-dev/ability/stage-formextension.md @@ -124,9 +124,8 @@ To create a widget in the stage model, you need to implement the lifecycle callb // Delete widget data. console.log('FormAbility onDestroy'); } - onAcquireFormState(want) { - console.log('FormAbility onAcquireFormState'); - return formInfo.FormState.READY; + onConfigurationUpdated(config) { + console.log('FormAbility onConfigurationUpdated, config:' + JSON.stringify(config)); } } ``` @@ -183,7 +182,7 @@ Configure the **module.json** file for the **Form** ability. | updateEnabled | Whether the widget can be updated periodically. Available values are as follows:
**true**: The widget can be updated periodically, depending on the update way you select, either at a specified interval (**updateDuration**) or at the scheduled time (**scheduledUpdateTime**). **updateDuration** is preferentially recommended.
**false**: The widget cannot be updated periodically.| Boolean | No | | scheduledUpdateTime | Scheduled time to update the widget. The value is in 24-hour format and accurate to minute. | String | Yes (initial value: **0:0**) | | updateDuration | Interval to update the widget. The value is a natural number, in the unit of 30 minutes.
If the value is **0**, this field does not take effect.
If the value is a positive integer ***N***, the interval is calculated by multiplying ***N*** and 30 minutes.| Number | Yes (initial value: **0**) | - | formConfigAbility | Name of the facility or activity used to adjust a widget. | String | Yes (initial value: left empty) | + | formConfigAbility | Indicates the link to a specific page of the application. The value is a URI. | String | Yes (initial value: left empty) | | formVisibleNotify | Whether the widget is allowed to use the widget visibility notification. | String | Yes (initial value: left empty) | | metaData | Metadata of the widget. This field contains the array of the **customizeData** field. | Object | Yes (initial value: left empty) | @@ -205,7 +204,8 @@ Configure the **module.json** file for the **Form** ability. "defaultDimension": "2*2", "updateEnabled": true, "scheduledUpdateTime": "10:30", - "updateDuration": 1 + "updateDuration": 1, + "formConfigAbility": "ability://ohos.samples.FormApplication.MainAbility" }] } ``` @@ -338,3 +338,11 @@ You can use HML, CSS, and JSON to develop the UI page for a JavaScript-programme Now you've got a widget shown below. ![fa-form-example](figures/fa-form-example.png) + +## Development Example + +The following sample is provided to help you better understand how to develop a widget on the stage model: + +[eTSFormExtAbility](https://gitee.com/openharmony/app_samples/tree/master/ability/eTSFormExtAbility) + +This **eTSFormExtAbility** sample provides a widget. Users can create, update, and delete widgets on the home screen of their phones or by using their own widget host. This sample also implements widget information persistence by using lightweight data storage.