From aa31fa8cdb42bc2b52ac38ee81cf70e6e9aee4f8 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 7 Sep 2020 20:44:57 +0200 Subject: [PATCH] Fix setInterval --- src/components/ftbot/ReloadControl.vue | 12 ++++++------ src/components/layout/NavBar.vue | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/ftbot/ReloadControl.vue b/src/components/ftbot/ReloadControl.vue index 461790bb..b875684c 100644 --- a/src/components/ftbot/ReloadControl.vue +++ b/src/components/ftbot/ReloadControl.vue @@ -14,9 +14,9 @@ import { Action, State } from 'vuex-class'; @Component({}) export default class ReloadControl extends Vue { - refreshInterval: NodeJS.Timer | null = null; + refreshInterval: number | null = null; - refreshIntervalSlow: NodeJS.Timer | null = null; + refreshIntervalSlow: number | null = null; created() { if (this.loggedIn) { @@ -63,13 +63,13 @@ export default class ReloadControl extends Vue { console.log('Starting automatic refresh.'); this.refreshFrequent(); if (this.autoRefresh) { - this.refreshInterval = setInterval(() => { + this.refreshInterval = window.setInterval(() => { this.refreshFrequent(); }, 5000); } this.refreshSlow(); if (this.autoRefresh) { - this.refreshIntervalSlow = setInterval(() => { + this.refreshIntervalSlow = window.setInterval(() => { this.refreshSlow(); }, 60000); } @@ -78,10 +78,10 @@ export default class ReloadControl extends Vue { stopRefresh() { console.log('Stopping automatic refresh.'); if (this.refreshInterval) { - clearInterval(this.refreshInterval); + window.clearInterval(this.refreshInterval); } if (this.refreshIntervalSlow) { - clearInterval(this.refreshIntervalSlow); + window.clearInterval(this.refreshIntervalSlow); } } diff --git a/src/components/layout/NavBar.vue b/src/components/layout/NavBar.vue index c3163c34..1912ccb1 100644 --- a/src/components/layout/NavBar.vue +++ b/src/components/layout/NavBar.vue @@ -55,7 +55,7 @@ const layoutNs = namespace('layout'); components: { LoginModal, BootswatchThemeSelect }, }) export default class NavBar extends Vue { - pingInterval: NodeJS.Timer | null = null; + pingInterval: number | null = null; @State loggedIn!: boolean; @@ -71,7 +71,7 @@ export default class NavBar extends Vue { mounted() { this.ping(); - this.pingInterval = setInterval(this.ping, 60000); + this.pingInterval = window.setInterval(this.ping, 60000); } beforeDestroy() {