• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Conditional Widget Updates
2
3Form Kit provides the following methods for conditional updates:
4
5- Network-triggered update: The widget content will be automatically updated by calling [onUpdateForm](../reference/apis-form-kit/js-apis-app-form-formExtensionAbility.md#onupdateform) when the network changes. This can be configured by setting the **conditionUpdate** field in the [form_config.json](arkts-ui-widget-configuration.md) file to **network**.
6
7> **NOTE**
8> 1. A widget update is triggered when the device transitions from a no-network state to a connected state. However, an update is not triggered when a user switches between networks (for example, switching between different Wi-Fi networks or between Wi-Fi and cellular data) or goes from Internet connection to no Internet connection.
9>
10> 2. To minimize the frequency of widget process initiations during frequent network on/off scenarios, a no-network condition is determined after the network has been continuously unavailable for 10 minutes. Upon reconnection, a network-based update is then triggered.
11>
12> 3. This functionality is valid only for widgets of system applications.
13
14
15  ```json
16  {
17    "forms": [
18      {
19        "name": "UpdateDuration",
20        "description": "$string:widget_updateduration_desc",
21        "src": "./ets/updateduration/pages/UpdateDurationCard.ets",
22        "uiSyntax": "arkts",
23        "window": {
24          "designWidth": 720,
25          "autoDesignWidth": true
26        },
27        "colorMode": "auto",
28        "isDefault": true,
29        "updateEnabled": true,
30        "scheduledUpdateTime": "10:30",
31        "updateDuration": 2,
32        "defaultDimension": "2*2",
33        "supportDimensions": [
34          "2*2"
35        ],
36        "conditionUpdate": [
37          "network"
38        ]
39      }
40    ]
41  }
42  ```
43