Add "action: Inject JS function objects" for advance user. You can pass a code string. Plugin will use eval to parse it then execute it.
The code string is
var my_add = function(fn)
fn.result = fn.param + fn.param;
fn.CallFn('message', 'I\'m at js function');
1. This code string is a function with one input parameter named 'fn' which is a part of function plugin.
2. Use command 'fn.InjectJS' to assign a js function into function plugin.
In this example:
- User can use 'action:call "my_add"' in event sheet to execute this js function
3. The 'my_add' function has a input parameter named "fn". It is the same as 'fn' at previous.
- 'fn.param' is to get the value set by 'action: set parameter'
- 'fn.result' is to set the value got by Function.Result.
- 'fn.CallFn(name, param0, param1)' can call any function defined in this function plugin, even in event sheet. In this example, it will call 'message' which is defined at event sheet to append some text at text object. Oh, it can return the value set by 'action: set Result'.
The API of internal function object (using in JS) are listed below.
A. set parameters, returns
:: input parameters, a hash
:: return values ,a hash
:: return value, single value
B. call function
- fn.CallFn(name, param0, param1...)