From 65cba508abe329bc7dd43e544c53ae69abce7365 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Wed, 24 Oct 2018 10:28:39 +0200 Subject: [PATCH] feat(keyboard): remove listeners from lifecycle events BREAKING CHANGE: lifecycle listeners will no longer receive field listeners * Listeners are no longer stored inside Keyboard. * Field `listeners` was removed from lifecycle events. --- lib/features/keyboard/Keyboard.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/features/keyboard/Keyboard.js b/lib/features/keyboard/Keyboard.js index 84876da72..c9b50ff68 100644 --- a/lib/features/keyboard/Keyboard.js +++ b/lib/features/keyboard/Keyboard.js @@ -36,7 +36,7 @@ var DEFAULT_PRIORITY = 1000; * - keyboard.init * - keyboard.destroy * - * All events contain the fields (node, listeners). + * All events contain one field which is node. * * A default binding for the keyboard may be specified via the * `keyboard.bindTo` configuration option. @@ -52,7 +52,6 @@ export default function Keyboard(config, eventBus, editorActions) { this._eventBus = eventBus; this._editorActions = editorActions; - this._listeners = []; this._keyHandler = this._keyHandler.bind(this); // properly clean dom registrations @@ -60,8 +59,6 @@ export default function Keyboard(config, eventBus, editorActions) { self._fire('destroy'); self.unbind(); - - self._listeners = []; }); eventBus.on('diagram.init', function() { @@ -131,7 +128,7 @@ Keyboard.prototype.unbind = function() { }; Keyboard.prototype._fire = function(event) { - this._eventBus.fire('keyboard.' + event, { node: this._node, listeners: this._listeners }); + this._eventBus.fire('keyboard.' + event, { node: this._node }); }; /** @@ -148,7 +145,6 @@ Keyboard.prototype.addListener = function(priority, listener) { priority = DEFAULT_PRIORITY; } - this._listeners.push(listener); this._eventBus.on(KEYDOWN_EVENT, priority, listener); };