From 27aafe0c8517fd01aa945b89387a7d192f9f1d82 Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 27 Jun 2014 23:06:06 +0100 Subject: [PATCH] panel:created panel:close panel:active plugin hooks --- client/src/models/application.js | 3 +++ client/src/models/panel.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/client/src/models/application.js b/client/src/models/application.js index d37b99c..4630b5c 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -157,7 +157,10 @@ // Keep track of the active panel. Channel/query/server or applet fn.bind('active', function (new_active_panel) { + var previous_panel = active_panel; active_panel = new_active_panel; + + _kiwi.global.events.emit('panel:active', {previous: previous_panel, active: active_panel}); }); return fn; diff --git a/client/src/models/panel.js b/client/src/models/panel.js index 1a6c43f..e3f15ca 100644 --- a/client/src/models/panel.js +++ b/client/src/models/panel.js @@ -6,9 +6,13 @@ _kiwi.model.Panel = Backbone.Model.extend({ "scrollback": [], "name": name }, {"silent": true}); + + _kiwi.global.events.emit('panel:created', {panel: this}); }, closePanel: function () { + _kiwi.global.events.emit('panel:close', {panel: this}); + if (this.view) { this.view.unbind(); this.view.remove(); -- 2.25.1