melanke / Watch.JS

watch the changes of any object or attribute

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attr1 and attr2 both change that function can be invoked

iquanduan opened this issue · comments

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?

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

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