Event off fixes (#9918)

* Added removes for all events

* Moved to beforeDestroy
This commit is contained in:
Keith Holliday
2018-02-01 10:14:21 -07:00
committed by GitHub
parent 7f8a9be766
commit 3e0a7c70ed
11 changed files with 38 additions and 21 deletions

View File

@@ -301,12 +301,18 @@ export default {
this.runYesterDailies();
// Do not remove the event listener as it's live for the entire app lifetime
document.addEventListener('mousemove', () => this.checkNextCron());
document.addEventListener('touchstart', () => this.checkNextCron());
document.addEventListener('mousedown', () => this.checkNextCron());
document.addEventListener('keydown', () => this.checkNextCron());
document.addEventListener('mousemove', this.checkNextCron);
document.addEventListener('touchstart', this.checkNextCron);
document.addEventListener('mousedown', this.checkNextCron);
document.addEventListener('keydown', this.checkNextCron);
});
},
beforeDestroy () {
document.removeEventListener('mousemove', this.checkNextCron);
document.removeEventListener('touchstart', this.checkNextCron);
document.removeEventListener('mousedown', this.checkNextCron);
document.removeEventListener('keydown', this.checkNextCron);
},
methods: {
checkUserAchievements () {
if (this.user.needsCron) return;