From 9b28d759146c854c6bd868caf4a526f6427a0d53 Mon Sep 17 00:00:00 2001 From: hfjallemark Date: Wed, 16 Jan 2013 10:10:23 +0100 Subject: [PATCH] add command support for deferreds/promises --- knockout.command.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/knockout.command.js b/knockout.command.js index abc5197..6ee180f 100644 --- a/knockout.command.js +++ b/knockout.command.js @@ -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; @@ -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; @@ -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, @@ -58,7 +58,7 @@ args.push(completeCallback); self.isExecuting(true); - executeDelegate.apply(this, args); + return executeDelegate.apply(this, args); }; return self;