mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 17:24:30 +00:00
Reload spots/alerts on visibility change. Closes #89
This commit is contained in:
@@ -351,4 +351,12 @@ $(document).ready(function() {
|
||||
loadOptions();
|
||||
// Update the refresh timing display every second
|
||||
setInterval(updateRefreshDisplay, 1000);
|
||||
});
|
||||
|
||||
// Reload alerts 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) {
|
||||
loadAlerts();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user