Browse Source

Add `onActive` method in ComponentView which executes on `active` event

pull/1359/head
Artur Arseniev 8 years ago
parent
commit
9677d9fbc7
  1. 6
      src/dom_components/view/ComponentView.js

6
src/dom_components/view/ComponentView.js

@ -32,6 +32,7 @@ module.exports = Backbone.View.extend({
this.listenTo(model, 'change:script', this.render); this.listenTo(model, 'change:script', this.render);
this.listenTo(model, 'change:content', this.updateContent); this.listenTo(model, 'change:content', this.updateContent);
this.listenTo(model, 'change', this.handleChange); this.listenTo(model, 'change', this.handleChange);
this.listenTo(model, 'active', this.onActive);
this.listenTo(classes, 'add remove change', this.updateClasses); this.listenTo(classes, 'add remove change', this.updateClasses);
$el.data('model', model); $el.data('model', model);
$el.data('collection', model.get('components')); $el.data('collection', model.get('components'));
@ -45,6 +46,11 @@ module.exports = Backbone.View.extend({
*/ */
init() {}, init() {},
/**
* Callback executed when the `active` event is triggered on component
*/
onActive() {},
/** /**
* Handle any property change * Handle any property change
* @private * @private

Loading…
Cancel
Save