|
|
|
@ -176,6 +176,7 @@ const Component = Backbone.Model.extend(Styleable).extend( |
|
|
|
this.config = opt.config || {}; |
|
|
|
this.ccid = Component.createId(this); |
|
|
|
this.set('attributes', this.get('attributes') || {}); |
|
|
|
this.on('destroy', this.handleRemove); |
|
|
|
this.listenTo(this, 'change:script', this.scriptUpdated); |
|
|
|
this.listenTo(this, 'change:traits', this.traitsUpdated); |
|
|
|
this.listenTo(this, 'change:tagName', this.tagUpdated); |
|
|
|
@ -191,6 +192,16 @@ const Component = Backbone.Model.extend(Styleable).extend( |
|
|
|
this.init(); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Triggered on model remove |
|
|
|
* @param {Model} removed Removed model |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
handleRemove(removed) { |
|
|
|
const em = this.em; |
|
|
|
em && em.trigger('component:remove', removed); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Check component's type |
|
|
|
* @param {string} type Component type |
|
|
|
|