Permalink
Browse files

Merge branch 'master' of github.com:kriskowal/q

  • Loading branch information...
kriskowal committed May 16, 2012
2 parents 614cd90 + 63a7afa commit 1048107494198611c0c6c2308af56a4015ad318d
Showing with 8 additions and 2 deletions.
  1. +8 −2 q.js
View
10 q.js
@@ -1389,8 +1389,14 @@ function ncall(callback, thisp /*, ...args*/) {
exports.nbind = nbind;
function nbind(callback /* thisp, ...args*/) {
if (arguments.length > 1) {
- var args = array_slice(arguments, 1);
- callback = callback.bind.apply(callback, args);
+ var thisp = arguments[1];
+ var args = array_slice(arguments, 2);
+
+ var originalCallback = callback;
+ callback = function () {
+ var combinedArgs = args.concat(array_slice(arguments));
+ return originalCallback.apply(thisp, combinedArgs);
+ };
}
return function () {
var deferred = defer();

0 comments on commit 1048107

Please sign in to comment.