Reputation: 4077
How can I retrieve the params when using listenTo
? For example, I have the following function in a collection:
add: function(models, options, firstTime) {
//stuff done
}
and I have this function in the view:
initialize: function() {
this.listenTo(this.collection, 'add', this.addAll);
}
The listener is working correctly --addAll in the view is being called when add is triggered in the collection--, but I don't know how can I retrieve the parameters that add
used. Is this possible to do? I want to listenTo(), and retrieve the arguments and the values used for the listened function.
How can I do it?
Upvotes: 1
Views: 1295
Reputation: 44599
You can't get access directly to the argument passed to add
unless you wrap the function or some similar solution.
Though, if you only want to access the changed attributes, then just check the model.change
property
Upvotes: 1