mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(util) retExec: add any count of params
This commit is contained in:
parent
46be594356
commit
77469928ab
1 changed files with 16 additions and 5 deletions
21
lib/util.js
21
lib/util.js
|
|
@ -697,11 +697,22 @@ Util = exports || {};
|
|||
* @param pCallBack
|
||||
* @param pArg
|
||||
*/
|
||||
Util.retExec = function(pCallBack, pArg) {
|
||||
return function(pArgument) {
|
||||
if ( !Util.isUndefined(pArg) )
|
||||
pArgument = pArg;
|
||||
Util.exec(pCallBack, pArgument);
|
||||
Util.retExec = function() {
|
||||
var args = arguments;
|
||||
|
||||
return function() {
|
||||
var argsLocal, callback,
|
||||
n = arguments.length;
|
||||
|
||||
if (!n)
|
||||
argsLocal = args;
|
||||
else {
|
||||
callback = args[0];
|
||||
argsLocal = arguments;
|
||||
[].unshift.call(argsLocal, callback);
|
||||
}
|
||||
|
||||
Util.exec.apply(null, argsLocal);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue