Command Reference CIB jsMerge
JavaScript Functions
Local Functions
Inside the template local functions and variables can be defined with the following syntax:
{# this.myFunc = function() { ... }}
{# this.i = 42}
The advantage of local functions is that they are only valid in the template that they are defined in and are thus protected. They cannot be overwritten by functions of other templates. Other templates cannot see these functions, enabling the usage of functions and variables of the same name in different templates without interference.
The function is referenced with this.myFunc(…), e.g. text(this.myFunc(…))