Clean up global listener in Sidebar component. (#4331)

Every time the component was mounted it would add another listener.
Since old listeners would often error this could cause a lot of log
spam, particularly when using the hotloader on a mobile device.
This commit is contained in:
John Sullivan 2021-10-13 13:19:34 -07:00 committed by GitHub
parent 2b634a6ba6
commit 5d76ed888c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,6 +195,9 @@ export default {
document.body.addEventListener("touchstart", this.onTouchStart, {passive: true});
},
destroyed() {
document.body.removeEventListener("touchstart", this.onTouchStart, {passive: true});
},
methods: {
isPublic: () => document.body.classList.contains("public"),
},