Whenever one of the defined properties is set to a new value, Avers will generate a change
event and propagate it to the root. You can set up callbacks and listen for these changes.
The callback is called with two arguments: the path at which the change happened and a description
of the change.
The change operation is a JSON description of what was changed at that path. In the future
Avers will be able to undo individual operations.
var user = Avers.mk(User, {});
user.on('change', function(path, op) {
console.log('Change at path:', path);
});
user.name = 'Fry';
// A message should show up in the log:
// Change at path: name
In the near future, Avers will stop polluting the class prototype with its
own functions. Then you'll have to use Avers.on(obj, 'change', function(){})
to listen to changes.