Here is a code snippet
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<div>
<div data-bind="yourBindingName: someValue ">
</div>
<button data-bind="click: clickme">Click me!</button>
</div>
<script type="text/javascript">
ko.bindingHandlers.yourBindingName = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
console.log("init");
},
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
console.log("update");
}
};
function ViewModel() {
this.someValue = ko.observable('test');
this.clickme = function () {
console.log('clickme');
this.someValue('');
}
}
ko.applyBindings(new ViewModel());
</script>
</body>
</html>
After clicking the "Click me!" button there is only 'clickme' in console and never 'update'. I expect the update function to be fired every time its bound value changed.