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.
This commit is contained in:
Graham McIntire 2025-08-05 13:59:24 -05:00
parent 44bc802f9d
commit 8bc5d35e2e
No known key found for this signature in database

View file

@ -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(
() => {