Is it possible in knockout to get the current value of an observable within a subscription to that observable, before it receives the new value?
Example:
<
ko.subscribable.fn.subscribeChanged = function (callback) {
var oldValue;
this.subscribe(function (_oldValue) {
oldValue = _oldValue;
}, this, 'beforeChange');
this.subscribe(function (newValue) {
callback(newValue, oldValue);
});
};
Use the above like this:
MyViewModel.MyObservableProperty.subscribeChanged(function (newValue, oldValue) {
});