Skip to content

Commit

Permalink
Merge pull request #32 from moity/master
Browse files Browse the repository at this point in the history
Add bindingContext to bindingHandlers to support Knockout 3.0
  • Loading branch information
Hans Fjällemark committed Nov 18, 2013
2 parents be71a10 + 1041841 commit e3146e4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions knockout.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
};

ko.bindingHandlers.command = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var
value = valueAccessor(),
commands = value.execute ? { click: value } : value,
Expand All @@ -92,7 +92,8 @@
element,
ko.utils.wrapAccessor(commands[command].execute),
allBindingsAccessor,
viewModel
viewModel,
bindingContext
);
}
},
Expand All @@ -110,14 +111,15 @@
element,
ko.utils.wrapAccessor(events),
allBindingsAccessor,
viewModel);
viewModel,
bindingContext);
};

initBindingHandlers();
initEventHandlers();
},

update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
var commands = valueAccessor();
var canExecute = commands.canExecute;

Expand All @@ -134,7 +136,7 @@
return;
}

ko.bindingHandlers.enable.update(element, canExecute, allBindingsAccessor, viewModel);
ko.bindingHandlers.enable.update(element, canExecute, allBindingsAccessor, viewModel, bindingContext);
}
};
})(ko);
})(ko);

0 comments on commit e3146e4

Please sign in to comment.