Fix JavaScript errors: variable hoisting and renamed function

- Move isWifiRunning and isBtRunning declarations to top of script
  to fix 'Cannot access before initialization' errors
- Update handleWifiNetwork hook to use renamed handleWifiNetworkImmediate
- Remove duplicate variable declarations
This commit is contained in:
James Smith
2025-12-29 22:13:43 +00:00
parent ec988dd35b
commit 61543b8b34
+7 -9
View File
@@ -3786,6 +3786,8 @@
let isSensorRunning = false; let isSensorRunning = false;
let isAdsbRunning = false; let isAdsbRunning = false;
let isIridiumRunning = false; let isIridiumRunning = false;
let isWifiRunning = false;
let isBtRunning = false;
let currentMode = 'pager'; let currentMode = 'pager';
let msgCount = 0; let msgCount = 0;
let pocsagCount = 0; let pocsagCount = 0;
@@ -5217,7 +5219,6 @@
// ============== WIFI RECONNAISSANCE ============== // ============== WIFI RECONNAISSANCE ==============
let wifiEventSource = null; let wifiEventSource = null;
let isWifiRunning = false;
let monitorInterface = null; let monitorInterface = null;
let wifiNetworks = {}; let wifiNetworks = {};
let wifiClients = {}; let wifiClients = {};
@@ -7008,17 +7009,14 @@
}); });
} }
// Hook into handleWifiNetwork to update visualizations // Hook into handleWifiNetworkImmediate to update visualizations
const originalHandleWifiNetwork = handleWifiNetwork; const originalHandleWifiNetworkImmediate = handleWifiNetworkImmediate;
handleWifiNetwork = function(net) { handleWifiNetworkImmediate = function(net) {
originalHandleWifiNetwork(net); originalHandleWifiNetworkImmediate(net);
// Update radar // Update radar
addNetworkToRadar(net); addNetworkToRadar(net);
// Update channel graph
updateChannelGraph();
// Update security donut // Update security donut
updateSecurityDonut(); updateSecurityDonut();
@@ -7026,6 +7024,7 @@
if (targetBssidForSignal === net.bssid) { if (targetBssidForSignal === net.bssid) {
updateSignalMeter(net); updateSignalMeter(net);
} }
// Note: Channel graphs are updated in the batched scheduleWifiUIUpdate
}; };
// Update targetNetwork to also set signal meter // Update targetNetwork to also set signal meter
@@ -7042,7 +7041,6 @@
// ============== BLUETOOTH RECONNAISSANCE ============== // ============== BLUETOOTH RECONNAISSANCE ==============
let btEventSource = null; let btEventSource = null;
let isBtRunning = false;
let btDevices = {}; let btDevices = {};
let btDeviceCount = 0; let btDeviceCount = 0;
let btBeaconCount = 0; let btBeaconCount = 0;