mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-08 03:00:26 -04:00
send 'add' and 'remove' events through the model.
This commit is contained in:
@@ -520,7 +520,7 @@
|
||||
this.models.splice(index, 0, model);
|
||||
model.bind('all', this._boundOnModelEvent);
|
||||
this.length++;
|
||||
if (!options.silent) this.trigger('add', model);
|
||||
if (!options.silent) model.trigger('add', model, this);
|
||||
return model;
|
||||
},
|
||||
|
||||
@@ -534,9 +534,9 @@
|
||||
delete this._byCid[model.cid];
|
||||
delete model.collection;
|
||||
this.models.splice(this.indexOf(model), 1);
|
||||
model.unbind('all', this._boundOnModelEvent);
|
||||
this.length--;
|
||||
if (!options.silent) this.trigger('remove', model);
|
||||
if (!options.silent) model.trigger('remove', model, this);
|
||||
model.unbind('all', this._boundOnModelEvent);
|
||||
return model;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user