in xf/src/xf.component.js [132:186]
_constructor: function() {
if (this.Collection) {
this.collection = new this.Collection({}, {
component: this
});
this.collection.construct();
} else if (this.Model) {
this.model = new this.Model({}, {
component: this
});
this.model.construct();
}
if (this.View) {
var params = {
attributes: {
'data-id': this.id
},
component: this
};
if (this.collection) {
params.collection = this.collection;
} else if (this.model) {
params.model = this.model;
}
this.view = new this.View(params);
this.view.construct();
}
this._bindListeners();
this.construct();
XF.trigger('component:' + this.id + ':constructed');
// TODO: decide where to place it
this.initialize();
if (this.view) {
this.view.listenToOnce(this.view, 'loaded', this.view.refresh);
this.view.on('rendered', _.bind(function() {
XF.trigger('component:' + this.id + ':rendered');
}, this));
}
if (this.collection && this.options.autoload) {
this.collection.refresh();
} else if (this.model && this.options.autoload) {
this.model.refresh();
} else if (this.view) {
this.view.refresh();
}
},