Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ map.on('locationerror', (e: L.ErrorEvent) => {
// Polling refcount helpers — shared by locate and recording
function activatePolling(): void {
state.updateCallback += 1;
if (import.meta.env.DEV && state.updateCallback > 2) {
console.warn('[webmap] updateCallback > 2 — possible activatePolling() leak', state.updateCallback);
}
if (state.updateCallback === 1) startWatching(map);
}

function deactivatePolling(): void {
state.prior = 1000;
state.updateCallback -= 1;
if (import.meta.env.DEV && state.updateCallback < 0) {
console.warn('[webmap] updateCallback < 0 — possible deactivatePolling() leak', state.updateCallback);
}
if (state.updateCallback === 0) stopWatching(map);
}

Expand Down
Loading