UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

113 lines (78 loc) 2.69 kB
# Interface: IAuWidgetFunctionTriggerConfig Provides properties that are used to execute synchronous or async functions. You can use these properties in **params** of the [AuWidgetFunctionTrigger](../classes/auwidgetfunctiontrigger.md) 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") }}", ] } } ] } ``` ## Hierarchy * **IAuWidgetFunctionTriggerConfig** ## Index ### Properties * [arguments](iauwidgetfunctiontriggerconfig.md#arguments) * [callback](iauwidgetfunctiontriggerconfig.md#callback) * [catch](iauwidgetfunctiontriggerconfig.md#catch) * [enabled](iauwidgetfunctiontriggerconfig.md#enabled) * [finally](iauwidgetfunctiontriggerconfig.md#finally) * [lock](iauwidgetfunctiontriggerconfig.md#lock) ## Properties ### arguments • **arguments**: *Array‹string› | string* An array of parameters change of which should trigger specified callbacks. ___ ### callback • **callback**: *Function | Array‹Function›* A function `("{{#function <expression>}}")` or an array of functions that are executed when `arguments` parameter changes. ___ ### catch • **catch**: *Function | Array‹Function›* A function `("{{#function <expression>}}")` or an array of functions that are executed if the `callback` fails. ___ ### enabled • **enabled**: *boolean* If `false`, the `callback` will not be executed. The default value is `true`. ___ ### finally • **finally**: *Function | Array‹Function›* A function `("{{#function <expression>}}")` or an array of functions that are executed after the `callback`, regardless of its outcome. ___ ### lock • **lock**: *string[] | string* The widget names that should be locked while waiting for the `callback`. The editor will show a preloader on this widget.