jsToolboxMJK.funcs.invoke() - mkloubert/jsToolbox GitHub Wiki
jsToolboxMJK.funcs.invoke(func [, ...args]) method
Invokes a function inside a try-catch block and returns the result as object.
Syntax
$jsTB.funcs.invoke(func [, ...args]);
Parameters
Name | Type | Description |
---|---|---|
func | Function | The function to invoke. |
args | mixed | [OPTIONAL] One or more argument for the function. |
Result
The result object.
s. here
Examples
// res.hasFailed = false
var res1 = $jsTB.funcs.invoke(function(a, b) {
// TM+MK
alert(a + '+' + b);
}, 'TM', 'MK');
// res.hasFailed = true
var res2 = $jsTB.funcs.invoke(function(a, b) {
// TM+MK
alert(a + '+' + b + '=' + c);
}, 'TM', 'MK');