How to use Webdata

Methods

getWebdata(keyopt)

Used to get the state value of the webdata variable. User can access to the webdata list in the Function > Variable panel.

Parameters:
NameTypeAttributesDescription
keystring<optional>

the variable name of the webdata

Example
const webdataMode = API.WEBDATAMONITOR.getWebdata("App.Page_1.LayoutInfo_1.mode");
console.log(webdataMode)

monitorWebdata(keyopt, callbackopt)

Used to subscribe a specific webdata. User can access to the webdata list in the Function > Variable panel.

Parameters:
NameTypeAttributesDescription
keystring<optional>

the variable name to be subscribed

callbackfunction<optional>

callback function called when variable's value changes

Example
API.WEBDATAMONITOR.monitorWebdata(
 "App.Page_1.LayoutInfo_1.mode",
 (v)=>{
   console.log(v);
 }
)

setWebdata(keyopt, valueopt)

Used to update the state value of the webdata variable User can access to the webdata list in the Function > Variable panel.

Parameters:
NameTypeAttributesDescription
keystring<optional>

the variable name of the webdata

valuestring<optional>

the value to be updated

Example
API.WEBDATAMONITOR.setWebdata(
 "App.Page_1.LayoutInfo_1.mode",
  "manual"
)