mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-28 11:25:25 +03:00
🔀 Merge pull request #767 from marekful/FIX/stop-status-checks
🩹 Stop status-check when Item is destroyed
This commit is contained in:
commit
7ab32858e2
@ -175,9 +175,13 @@ export default {
|
|||||||
if (this.enableStatusCheck) this.checkWebsiteStatus();
|
if (this.enableStatusCheck) this.checkWebsiteStatus();
|
||||||
// If continious status checking is enabled, then start ever-lasting loop
|
// If continious status checking is enabled, then start ever-lasting loop
|
||||||
if (this.statusCheckInterval > 0) {
|
if (this.statusCheckInterval > 0) {
|
||||||
setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000);
|
this.intervalId = setInterval(this.checkWebsiteStatus, this.statusCheckInterval * 1000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// Stop periodic status-check when item is destroyed (e.g. navigating in multi-page setup)
|
||||||
|
if (this.intervalId) clearInterval(this.intervalId);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
statusResponse: undefined,
|
statusResponse: undefined,
|
||||||
contextMenuOpen: false,
|
contextMenuOpen: false,
|
||||||
|
intervalId: undefined, // status-check setInterval() id
|
||||||
contextPos: {
|
contextPos: {
|
||||||
posX: undefined,
|
posX: undefined,
|
||||||
posY: undefined,
|
posY: undefined,
|
||||||
|
Loading…
Reference in New Issue
Block a user