Skip to content

Instantly share code, notes, and snippets.

@beyond-code-github
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyond-code-github/8742204 to your computer and use it in GitHub Desktop.
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
//....
//....
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