observer
v0.0.2
Published
Observes your javascript objects
Downloads
63
Readme
Observer
Observes your javascript objects
Example :
var Observer = require("observer");
var userObject = {
username : 'kucukkanat',
email : '[email protected]',
attrs : {
a:5,
b:666
}
}
var userObserver = new Observer(userObject);
userObserver.watch('username')
.then(function(nv){
console.log("User object changed to : ",nv)
})
userObserver.watch('attrs')
.then(function(nv){
console.log("User object changed to : ",nv)
})
// Make changes after observing
userObject.username = 'nepjua';
userObject.username = 'naber';
userObject.attrs.a = 'tolga';