From 0ac2af032f38f06d590eddc3be34b681d2d85be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Fri, 20 Apr 2018 07:24:27 +0200 Subject: [PATCH] Add destroy method --- tiling.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tiling.js b/tiling.js index e4c1605..71f3ed2 100644 --- a/tiling.js +++ b/tiling.js @@ -141,6 +141,13 @@ class Space extends Array { } return null; } + + destroy() { + let workspace = this.workspace; + workspace.disconnect(this.addSignal); + workspace.disconnect(this.removeSignal); + this.cloneContainer.destroy(); + } } /** @@ -199,10 +206,7 @@ class Spaces extends Map { }; removeSpace(space) { - let workspace = space.workspace; - workspace.disconnect(space.addSignal); - workspace.disconnect(space.removeSignal); - space.cloneContainer.destroy(); + space.destroy(); this.delete(workspace); };