diff --git a/lib/util.js b/lib/util.js index 425e8a3a..b73c2ced 100644 --- a/lib/util.js +++ b/lib/util.js @@ -55,6 +55,17 @@ } }, + this.bind = function(callback) { + var result, + args = Util.slice(arguments, 1), + bind = Function.prototype.bind; + + args.unshift(null); + result = bind.apply(callback, args); + + return result; + }; + /** * ad new line (if it's not) * @param {string} pText @@ -710,17 +721,13 @@ * return save exec function * @param callback */ - this.retExec = function(callback) { - var args = Util.slice(arguments); + this.retExec = function() { + var result, + exec = Util.exec.bind(Util); - return function() { - var argsLocal = Util.slice(arguments); - callback; - - argsLocal = args.concat(argsLocal); - - Util.exec.apply(null, argsLocal); - }; + result = Util.bind.apply(exec, arguments); + + return result; }; /**