Skip to content

Instantly share code, notes, and snippets.

@beyond-code-github
Last active August 29, 2015 13:55
Embed
What would you like to do?
Skeleton change tracked array extender for knockout.kj
ko.extenders.trackArrayChange = function (target, track) {
if (track) {
target.isDirty = ko.observable(false);
target.added = ko.observableArray([]);
target.removed = ko.observableArray([]);
var addItem = function (item) {
//...
};
var removeItem = function (item) {
//...
};
target.getChanges = function () {
var result = {
added: target.added,
removed: target.removed
};
return result;
};
//....
//....
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment