Here's the current docs for scriptable options: Scriptable Options | Musson Industrial
It is JavaScript, but currently the return semantics are kinda messed up.
You must provide an arrow function, but currently (v1.x.x), the converted functions do not support direct expressions. The return
keyword must be used.
For example, in the tick.callback
earlier you had to use the return
keyword, even though the function should be able to run as an expression.
I am planning to fix this in 2.0, and it will be a breaking change:
// 1.X.X (Arrow function syntax, anonymous function return semantics)
callback: '(value) => return value.toFixed(1)' # valid
callback: '(value) => { return value.toFixed(1) }' # valid
callback: '(value) => value.toFixed(1)' # invalid
// 2.X.X (Arrow function syntax/semantics)
callback: '(value) => return value.toFixed(1)' # invalid
callback: '(value) => { return value.toFixed(1) }' # valid
callback: '(value) => value.toFixed(1)' # valid
It should have been that way from the beginning and I didn't catch it . If you want to future proof yourself, use the middle syntax (braces block with an explicit return).
Also worth mentioning is the global self
and client
parameters will be replaced by a this
context. You will still be able to access the component and the client stores, but you'll do it through this
.