melanke / Watch.JS

watch the changes of any object or attribute
Other
2.14k stars 219 forks source link

attr1 and attr2 both change that function can be invoked #85

Open iquanduan opened 9 years ago

iquanduan commented 9 years ago

Is this feature in Watch JS? for example:

var a = { attr1: a, attr2: b }

watch(a, ['attr1', 'attr2'], function(){

})

a.attr1 = aa;

a.attr2 = bb;

I want when attr1 and attr2 both change that the function can be invoked.

Does Watch JS support this?

konradpodgorski commented 9 years ago

I must do the same in project I'm working on.

I think simplest workaround would be to use underscore debounce function with small wait time, like 20ms

melanke commented 6 years ago

Sadly we don't have this feature, really useful but hard to implement.