Last active
August 29, 2015 13:55
-
-
Save beyond-code-github/8742204 to your computer and use it in GitHub Desktop.
Modified version of apply change tracking to observable that properly track arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.... | |
//.... | |
var applyChangeTrackingToObservable = function (observable) { | |
// Only apply to basic writeable observables | |
if (observable && !observable.nodeType && !observable.refresh && ko.isObservable(observable)) { | |
if (observable.isObservableArray) { | |
observable.extend({ trackArrayChange: true }); | |
} | |
else { | |
if (!observable.isDirty) observable.extend({ trackChange: true }); | |
} | |
} | |
}; | |
//.... | |
//.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment