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