Skip to content

Commit

Permalink
fix: Unbind to socket events
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 2, 2020
1 parent a8235d1 commit 348ab6b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/Mesh.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
}
}
}
</script>

0 comments on commit 348ab6b

Please sign in to comment.