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:
parent
44bc802f9d
commit
8bc5d35e2e
1 changed files with 10 additions and 10 deletions
|
|
@ -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(
|
||||
() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue