melanke / Watch.JS

watch the changes of any object or attribute

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WatchJS does multiple callbacks when we push an element on a watched Array

mritzman opened this issue · comments

If you have multiple watchers for an array and push an element, WatchJS calls EACH watcher as many as the number of total watchers on the array. For example, if you have an array with two watchers, EACH watcher is called two times when an element is pushed onto the array. If you have an array with three watchers, each watcher is called three times when an element is added...

This is problem is reproduced with here: http://jsfiddle.net/66zzW/

Here is a screenshot showing the problem:
watchjsproblem

This seems to be the case for any change:

http://jsfiddle.net/mhelvens/7q9rrLya/1/

That's pretty important.