Interface IAuWidgetFunctionTriggerConfig
Provides properties that are used to execute synchronous or async functions. You can use these properties in params of the AuWidgetFunctionTrigger class.
The following example illustrates how you can listen for property changes to execute a custom function.
{
"widgets": [
{
"name": "name",
"type": "option",
"params": {
"type": "list",
"title": "Name",
"prompt": "Choose a name",
"values": [
{ "title": "Jack" },
{ "title": "James" },
{ "title": "John" }
]
}
},
{
"name": "myFunction",
"type": "function-trigger",
"params": {
"arguments": [
"{{ $['name']._.title }}",
"{{ $['name']._.title }}"
],
"callback": [
"{{ #function(arg1, arg2) console.log(arg1, arg2) }}",
"{{ #asyncFunction await new Promise(...) }}"
]
"catch": [
"{{ #function console.error("failed") }}",
],
"finally": [
"{{ #function console.log("cleanup") }}",
]
}
}
]
}
Package: ui-framework
Properties
arguments
An array of parameters change of which should trigger specified callbacks.
Declaration
arguments: Array<string> | string
Property Value
Type | Description |
---|---|
Array<string> | string | An array of parameters change of which should trigger specified callbacks. |
callback
A function ("{{#function <expression>}}")
or an array of functions that are executed when arguments
parameter changes.
Declaration
callback: Function | Array<Function>
Property Value
Type | Description |
---|---|
Function | Array<Function> | A function |
catch
A function ("{{#function <expression>}}")
or an array of functions that are executed if the callback
fails.
Declaration
catch: Function | Array<Function>
Property Value
Type | Description |
---|---|
Function | Array<Function> | A function |
enabled
If false
, the callback
will not be executed. The default value is true
.
Declaration
enabled: boolean
Property Value
Type | Description |
---|---|
boolean | If |
finally
A function ("{{#function <expression>}}")
or an array of functions that are executed after the callback
, regardless of its outcome.
Declaration
finally: Function | Array<Function>
Property Value
Type | Description |
---|---|
Function | Array<Function> | A function |
lock
The widget names that should be locked while waiting for the callback
. The editor will show a preloader on this widget.
Declaration
lock: string[] | string
Property Value
Type | Description |
---|---|
string[] | string | The widget names that should be locked while waiting for the |