Watch.JS icon indicating copy to clipboard operation
Watch.JS copied to clipboard

watch 'all' fails on undefined properties

Open aleemb opened this issue 12 years ago • 1 comments

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.

aleemb avatar Jan 30 '13 13:01 aleemb

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.

melanke avatar Feb 21 '13 13:02 melanke