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
|
|
@ -405,16 +405,6 @@ let MapAPRSMap = {
|
||||||
console.error("Error invalidating map size:", 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
|
// Helper function to send map ready events with retry
|
||||||
self.sendMapReadyEvents = (retryCount = 0) => {
|
self.sendMapReadyEvents = (retryCount = 0) => {
|
||||||
if (self.pushEvent && typeof self.pushEvent === "function" && !self.isDestroyed) {
|
if (self.pushEvent && typeof self.pushEvent === "function" && !self.isDestroyed) {
|
||||||
|
|
@ -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)
|
// Start periodic cleanup of old trail positions (every 5 minutes)
|
||||||
self.cleanupInterval = setInterval(
|
self.cleanupInterval = setInterval(
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue