Watch.JS
Watch.JS copied to clipboard
watch 'all' fails on undefined properties
Watch works just fine for undefined keys as advertised in the docs:
var foo = {}
watch(foo, 'bar', function() { console.log('changed'); });
foo.bar = 'fubar';
// watch fires!
However, when watching the entire object, it doesn't fire:
var foo = {}
watch(foo, function() { console.log('changed'); });
foo.bar = 'fubar';
// foo changed but watch doesn't fire!
Until this gets fixed, any work around in the interim would be much appreciated.
WatchJS cant forecast attributes and so it cant put a listener to an unexistent attribute. If you have an idea for implementing this please tell me.