From 348ab6b11a3ee476b7e0a1bc3759ba5e1a056134 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Thu, 2 Jan 2020 15:54:54 +0100 Subject: [PATCH] fix: Unbind to socket events --- src/components/Mesh.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/Mesh.vue b/src/components/Mesh.vue index ec3141f0f93..16db60c5883 100644 --- a/src/components/Mesh.vue +++ b/src/components/Mesh.vue @@ -251,6 +251,8 @@ export default { var mesh = document.getElementById('mesh') var isDown = false var offset = [0, 0] + + // TODO: Update dimensions on screen resize var dimensions = [mesh.clientWidth, mesh.clientHeight] propertiesDiv.addEventListener('mousedown', function (e) { @@ -275,6 +277,13 @@ export default { if (r > 0 && r < dimensions[1]) { propertiesDiv.style.top = r + offset[1] + 'px' } } }, true) + }, + beforeDestroy () { + if (this.socket) { // unbind events + for (const event in this.socketEvents) { + this.socket.off(event) + } + } } }