mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-17 16:24:18 +01:00
clear intervals on disconnect
This commit is contained in:
@@ -77,6 +77,10 @@ class Connection {
|
|||||||
// update ui
|
// update ui
|
||||||
GlobalState.connection = null;
|
GlobalState.connection = null;
|
||||||
|
|
||||||
|
// clear previous connection timers
|
||||||
|
clearInterval(GlobalState.batteryPercentageInterval);
|
||||||
|
GlobalState.batteryPercentageInterval = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async onConnected() {
|
static async onConnected() {
|
||||||
@@ -155,7 +159,7 @@ class Connection {
|
|||||||
await this.updateBatteryPercentage();
|
await this.updateBatteryPercentage();
|
||||||
|
|
||||||
// auto update battery percentage once per minute
|
// auto update battery percentage once per minute
|
||||||
setInterval(async () => {
|
GlobalState.batteryPercentageInterval = setInterval(async () => {
|
||||||
await this.updateBatteryPercentage();
|
await this.updateBatteryPercentage();
|
||||||
}, 60000);
|
}, 60000);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const globalState = reactive({
|
|||||||
isDatabaseReady: false,
|
isDatabaseReady: false,
|
||||||
selfInfo: null,
|
selfInfo: null,
|
||||||
batteryPercentage: null,
|
batteryPercentage: null,
|
||||||
|
batteryPercentageInterval: null,
|
||||||
contacts: [],
|
contacts: [],
|
||||||
channels: [
|
channels: [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user