Skip to content

Instantly share code, notes, and snippets.

@beyond-code-github
Last active January 3, 2016 00:49
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/8385625 to your computer and use it in GitHub Desktop.
Save beyond-code-github/8385625 to your computer and use it in GitHub Desktop.
Example of change tracking behavior after applying complex object detection
var viewModel = {
Name: ko.observable("Pete"),
Age: ko.observable(29),
Skills: {
Tdd: ko.observable(true),
Knockout: ko.observable(true),
ChangeTracking: ko.observable(false),
},
Occupation: ko.observable("Developer")
};
applyChangeTracking(viewModel);
viewModel.Skills().ChangeTracking(true);
getChangesFromModel(viewModel);
/* -> {
"Skills": {
Tdd: function observable() { .... },
Knockout: function observable() { .... },
ChangeTracking: function observable() { .... },
}
} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment