Skip to content

Commit

Permalink
add command support for deferreds/promises
Browse files Browse the repository at this point in the history
  • Loading branch information
hfjallemark committed Jan 16, 2013
1 parent 82436fd commit 9b28d75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions knockout.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ko.command = function(options) {
var
self = function() {
self.execute.apply(this, arguments);
return self.execute.apply(this, arguments);
},
canExecuteDelegate = options.canExecute,
executeDelegate = options.execute;
Expand All @@ -18,7 +18,7 @@
// Needed for anchors since they don't support the disabled state
if (!self.canExecute()) return

executeDelegate.apply(this, [arg1, arg2]);
return executeDelegate.apply(this, [arg1, arg2]);
};

return self;
Expand All @@ -27,7 +27,7 @@
ko.asyncCommand = function(options) {
var
self = function() {
self.execute.apply(this, arguments);
return self.execute.apply(this, arguments);
},
canExecuteDelegate = options.canExecute,
executeDelegate = options.execute,
Expand Down Expand Up @@ -58,7 +58,7 @@

args.push(completeCallback);
self.isExecuting(true);
executeDelegate.apply(this, args);
return executeDelegate.apply(this, args);
};

return self;
Expand Down

0 comments on commit 9b28d75

Please sign in to comment.