The API.WEBDATAMONITOR namespace provides a set of interfaces for easily and quickly adding webdata monitoring and processing transactions. The webdata variable can be added under the container component (behavior --> Add variable), and the variable can be used in the code editor. This API allows you to monitor changes to webdata variables and update their values. This API is ideal for situations where you want stateful management, but don't want to use RAPID variables.
- Source
Methods
getWebdata(keyopt) → {Promise.<object>}
Gset the webdata's value.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key | string | <optional> | The key name of the webdata. |
- Source
Returns:
The webdata value.
- Type:
- Promise.<object>
Example
const webdataMode = API.WEBDATAMONITOR.getWebdata("App.page.LayoutInfo_1.mode");
console.log(webdataMode)monitorWebdata(keyopt, callbackopt)
Subscribes to a webdata.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key | string | <optional> | The webdata name. |
callback | function | <optional> | The callback function that is called when the webdata changes. |
- Source
Example
API.WEBDATAMONITOR.monitorWebdata(
"App.page.LayoutInfo_1.mode",
(v)=>{
console.log(v);
}
)setWebdata(keyopt, valueopt)
Updates the value of a specified webdata.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key | string | <optional> | The webdata name. |
value | string | <optional> | The value to be updated. |
- Source
Example
API.WEBDATAMONITOR.setWebdata(
"App.page.LayoutInfo_1.mode",
"manual"
)