From 8bc5d35e2e075d337353522b996605d4565bf105 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 5 Aug 2025 13:59:24 -0500 Subject: [PATCH] fix: move sendMapReadyEvents definition before whenReady callback The function was being called before it was defined, causing a runtime error. Moving the function definition before the whenReady callback ensures it's available when the callback executes. --- assets/js/map.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/js/map.ts b/assets/js/map.ts index ce8569a..54f4e78 100644 --- a/assets/js/map.ts +++ b/assets/js/map.ts @@ -404,16 +404,6 @@ let MapAPRSMap = { } catch (error) { console.error("Error invalidating map size:", error); } - - // Track when map is ready - self.map!.whenReady(() => { - try { - self.lastZoom = self.map!.getZoom(); - self.sendMapReadyEvents(); - } catch (error) { - console.error("Error in map ready callback:", error); - } - }); // Helper function to send map ready events with retry self.sendMapReadyEvents = (retryCount = 0) => { @@ -437,6 +427,16 @@ let MapAPRSMap = { } }; + // Track when map is ready + self.map!.whenReady(() => { + try { + self.lastZoom = self.map!.getZoom(); + self.sendMapReadyEvents(); + } catch (error) { + console.error("Error in map ready callback:", error); + } + }); + // Start periodic cleanup of old trail positions (every 5 minutes) self.cleanupInterval = setInterval( () => {