js
|
|
js |
defines a custom JavaScript function which is executed. The function receives the userData and the object objects which can be used. The function can optionally return the following values |
|
|
Promise.resolve() |
continues the menu chain without a payload |
Promise.resolve(data) |
continues the menu chain with data as payload, where data can be an JavaScript object |
Promise.reject(error) |
throws the given error |
abort() |
cancels the menu chain |
When nothing is returned the menu chain will continue without a payload
.
Resolve without data
{
"label": "JavaScript",
"icon": "icon-fire",
"action": "js",
"actionValues": [
{
"js": "return Promise.resolve();"
}
]
}
Resolve with data
{
"label": "JavaScript",
"icon": "icon-fire",
"action": "js",
"actionValues": [
{
"js": "const data = 'test'; return Promise.resolve(data);"
}
]
}
Resolve with error
{
"label": "JavaScript",
"icon": "icon-fire",
"action": "js",
"actionValues": [
{
"js": "if(/*something work*/) {} else {return Promise.reject(error);}"
}
]
}
{
"label": "JavaScript",
"icon": "icon-fire",
"action": "js",
"actionValues": [
{
"js": "if(/*something not work*/) {abort()};"
}
]
}