au-widget-function-trigger/au-widget-function-trigger
Classes
AuWidgetFunctionTrigger
A non-visual widget that is used to listen for property changes to execute custom functions. Can be used in other widgets.
The following example illustrates how you can listen for property changes to execute custom functions.
{
"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") }}",
]
}
}
]
}
Constructors
Constructor
new AuWidgetFunctionTrigger(): AuWidgetFunctionTrigger;
Returns
Inherited from
AuBaseInvisibleWidget.constructor;
Properties
enabled
enabled: boolean = true;
If false, the callback will not be executed. The default value is true.
params
params: any;
Compiled widget configuration.
Inherited from
AuBaseInvisibleWidget.params;
Accessors
template
Get Signature
get static template(): any;
Returns
any
Inherited from
AuBaseInvisibleWidget.template;
Methods
checkInitDependenciesWidgets()
checkInitDependenciesWidgets(): string[];
Returns an array of widget names, due to which the current widget cannot receive parameters.
Returns
string[]
Inherited from
AuBaseInvisibleWidget.checkInitDependenciesWidgets;
resetPreloaderState()
resetPreloaderState(): void;
Returns
void
Inherited from
AuBaseInvisibleWidget.resetPreloaderState;
showPreloader()
showPreloader(
isPreload,
message?,
timeout?): void;
Shows a preloader.
"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
isPreload | boolean | undefined | If true, enables the preloader. |
message | string | string[] | ... | A text message that appears next to the preloader. |
timeout | number | 5 | - |
Returns
void
Inherited from
AuBaseInvisibleWidget.showPreloader;
showToast()
showToast(data?, duration?): void;
Shows a toast.
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Parameters
| Parameter | Type | Description |
|---|---|---|
data? | string | A string message to display in the toast. |
duration? | number | Defines how long to show the toast for. |
Returns
void
Inherited from
AuBaseInvisibleWidget.showToast;
References
widget
Renames and re-exports AuWidgetFunctionTrigger