A slight change in Beagle90's answer. Always return a subscription to be able to access the utility (), for example.
ko.subscribable.fn.subscribeChanged = function (callback) { var oldValue; this.subscribe(function (_oldValue) { oldValue = _oldValue; }, this, 'beforeChange'); var subscription = this.subscribe(function (newValue) { callback(newValue, oldValue); });
Andries Dec 22 '14 at 9:35 2014-12-22 09:35
source share