Asked By: Anonymous
I am trying to trace all of the zombies in my application and get better understanding of how the event binding happens.
I have a view that binds its collection
"add" event to its
_.bindAll(this, "render"); this.collection.bind("add", this.render);
So if I log something in my render function I can see in console that rendering happened twice right after user adds new model through UI. The console output looks like this:
rendering index.js?body=1 (line 88) POST http://localhost:3000/tasks jquery.js?body=1 (line 8103) rendering index.js?body=1 (line 88)
I wonder why is this happening. I know for a fact that model was added only once to the collection so that makes me think that event should only be fired once. Then I don’t understand why
render was executed twice.
I have looked in similar question here but it is different because I am using
add event instead of
Answered By: Anonymous
It turned out that there was an additional binding to
render through Event Aggregator. It was added by another developer.