mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
Event off fixes (#9918)
* Added removes for all events * Moved to beforeDestroy
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user