Reload spots/alerts on visibility change. Closes #89

This commit is contained in:
Ian Renton
2025-12-27 15:57:38 +00:00
parent 6d9bf3d4ec
commit 6af15e4cfd
9 changed files with 33 additions and 17 deletions

View File

@@ -49,4 +49,12 @@ function filtersUpdated() {
function toggleDarkMode() {
enableDarkMode($("#darkMode")[0].checked);
saveSettings();
}
}
// Reload spots on becoming visible. This forces a refresh when used as a PWA and the user switches back to the PWA
// after some time has passed with it in the background.
addEventListener("visibilitychange", (event) => {
if (!document.hidden) {
loadSpots();
}
});