mirror of
https://github.com/Lissy93/dashy.git
synced 2025-04-08 17:06:18 +02:00
⚡ Clear the setInterval when component destroyed
This commit is contained in:
parent
ddce3f4c81
commit
22199394f2
@ -91,6 +91,7 @@ export default {
|
||||
posX: undefined,
|
||||
posY: undefined,
|
||||
},
|
||||
intervalEvent: undefined,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
@ -246,9 +247,12 @@ export default {
|
||||
this.kickOffCheck();
|
||||
// If continious status checking is enabled, then start ever-lasting loop
|
||||
if (this.statusCheckInterval > 0) {
|
||||
setInterval(this.kickOffCheck, this.statusCheckInterval * 1000);
|
||||
this.intervalEvent = setInterval(this.kickOffCheck, this.statusCheckInterval * 1000);
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.intervalEvent);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user