electron-devtools-vendor
Version:
<div align="center"> <h2>electron-devtools-vendor</h2> <img alt="MIT" src="https://img.shields.io/github/license/BlackHole1/electron-devtools-vendor?color=9cf&style=flat-square"> <img alt="GitHub repo size" src="https://img.shields.io/github/r
35 lines (26 loc) • 917 B
JavaScript
Modules.set('collections.Collection', function() {
// imports
var Component = Modules.get('Component');
var u = Modules.get('utils');
var Collection = Component.extend({
constructor: function(models) {
this.models = models || [];
this.length = this.models.length;
this.initialize.apply(this, arguments);
},
// add the model instance to the collection
add: function(model) {
this.models.push(model);
this.length = this.models.length;
// re-trigger any model event
this.listenTo(model, 'all', function(eventName /*, arg1, ... , argN */) {
this.trigger.apply(this, arguments);
});
this.trigger('add', model, this);
},
at: function(index) {
return this.models[index];
}
});
return Collection;
});