Project Description
Change tracking for tracking state of a JavaScript View Model when using KnockoutJS (http://www.knockout.com)

To Setup change tracking, add this tracker property to your view model:

 

viewModel.tracker = new ChangeTracker(viewModel);

 

Hook these into your view to determine when changes occur:

 

viewModel.tracker().somethingHasChanged();

 

Hook this into your view model when you want to reset state in functions (ex: load, save):

 

viewModel.tracker().markCurrentStateAsClean;

 

Optionally, you can pass your own hashFunction for state tracking, too.

Last edited Feb 19, 2012 at 7:48 PM by johnpapa, version 4