From 9677d9fbc72c681e0cb99a7642350d481d24635a Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 20 Jul 2018 08:34:25 +0200 Subject: [PATCH] Add `onActive` method in ComponentView which executes on `active` event --- src/dom_components/view/ComponentView.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dom_components/view/ComponentView.js b/src/dom_components/view/ComponentView.js index 956cf46d91..ffdb8ea3c1 100644 --- a/src/dom_components/view/ComponentView.js +++ b/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:content', this.updateContent); this.listenTo(model, 'change', this.handleChange); + this.listenTo(model, 'active', this.onActive); this.listenTo(classes, 'add remove change', this.updateClasses); $el.data('model', model); $el.data('collection', model.get('components')); @@ -45,6 +46,11 @@ module.exports = Backbone.View.extend({ */ init() {}, + /** + * Callback executed when the `active` event is triggered on component + */ + onActive() {}, + /** * Handle any property change * @private