From a099fdf997fc84e53a1d73f3963cc4b3abda12ce Mon Sep 17 00:00:00 2001 From: tim-bellette Date: Mon, 5 Aug 2013 20:41:11 +1000 Subject: [PATCH] Added support for passing boolean values to ko.bindingHandlers.activity Added support for passing boolean values to ko.bindingHandlers.activity; previously only supported functions. --- knockout.activity.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/knockout.activity.js b/knockout.activity.js index 8d9c572..3d348f8 100644 --- a/knockout.activity.js +++ b/knockout.activity.js @@ -233,7 +233,7 @@ })(jQuery); -// By: Hans Fjällemark and John Papa +// By: Hans Fj�llemark and John Papa // https://github.com/CodeSeven/KoLite ;(function($) { @@ -374,8 +374,9 @@ }, update: function (element, valueAccessor) { - var activity = valueAccessor()(); + var value = ko.utils.unwrapObservable(valueAccessor()); + var activity = $.isFunction(value) ? value() : value; typeof activity !== 'boolean' || $(element).activityEx(activity); } }; -})(jQuery, ko); \ No newline at end of file +})(jQuery, ko);