BlueSpire/Durandal — pull request #490 by jbblanchet (2014-04-26 18:23:18+00:00)
Title: Add optional change detection

When using the observable plugin, add an option to register a method on each object to automatically detect changes. This method receives as parameters: the obj that has changed, the name of the changed property, and either the newValue if it's a value type, or the arrayChange object if it's an array.

For example, you could add an hasChanged(obj, propertyName, newValue, arrayChanged) function on the shell, and be notified any time a value changes on any module, so you can either save the value of update a dirty flag.

It's possible to register multiple methods (as long as the have the same name), so for example the shell could be notified to keep a global dirty flag for navigation, and the viewmodel could be notified to send the updated data to the server.