jsfiddle link: http://jsfiddle.net/T8ee7/
When I call Knockout\'s subscribe method is there a way I can get both the previous and new value? Right now, I can only call g
This seems to work for me
ko.observable.fn.beforeAndAfterSubscribe = function (callback, target) {
var _oldValue;
this.subscribe(function (oldValue) {
_oldValue = oldValue;
}, null, 'beforeChange');
this.subscribe(function (newValue) {
callback.call(target, _oldValue, newValue);
});
};