Using a function within a function
Within a JavaScript function, the TwinCAT HMI can use another JavaScript function. To do this, a reference to the function must be created via the framework API. The function can be used once its validity has been verified.
// get user function
var myCustomFunction1 = TcHmi.Functions.getFunction('MyCustomFunction1');
// check if the reference is valid
if (myCustomFunction1)
{
var myParameter = "Sample";
// function call
var output = myCustomFunction1(myParameter);
// ...
}