in backbone events items bubbled collections, while executing this:
var c = new backbone.collection([]); var item = new backbone.model({id:3}); item.on('ping', function() { console.log('ping [item]', this); }); c.add(item); c.on('ping', function() { console.log('ping [collection]', this); });
we'll see both "ping[item]" , "ping[collection]" printed. 1 thing i'm still failing understand event attached collection - how should find out on item bubbled event had happened.
i can see no arguments passed, , context predictably collection itself. have strong suspicions not possible @ all, in case i'm stuck understanding why need kind of bubbling @ all.
c.on('ping', function(addedmodel, collection) {
the 1st argument of anonymous function the model has been added collection.
the 2nd argument actual collection.