Update map and bands pages to use SSE endpoint after initial load. Closes #43.

This commit is contained in:
Ian Renton
2026-06-26 09:09:15 +01:00
parent d1df772649
commit 998b394d2c
14 changed files with 234 additions and 85 deletions

View File

@@ -1,7 +1,5 @@
// Storage for the options that the server gives us. This will define our filters.
let options = {};
// Last time we updated the spots/alerts list on display.
let lastUpdateTime;
// Normally load user settings from local storage, unless embedded mode is in use
let useLocalStorage = true;
@@ -145,27 +143,6 @@ function toggleFilterButtons(filterQuery, state) {
filtersUpdated();
}
// Update the refresh timing display
function updateRefreshDisplay() {
if (lastUpdateTime != null) {
let secSinceUpdate = moment.duration(moment().diff(lastUpdateTime)).asSeconds();
let count = REFRESH_INTERVAL_SEC;
let updatingString = "Updating..."
if (secSinceUpdate < REFRESH_INTERVAL_SEC) {
count = REFRESH_INTERVAL_SEC - secSinceUpdate;
let number;
if (count <= 60) {
number = count.toFixed(0);
updatingString = "<span class='nowrap'>Updating in " + number + " second" + (number !== "1" ? "s" : "") + ".</span>";
} else {
number = Math.round(count / 60.0).toFixed(0);
updatingString = "<span class='nowrap'>Updating in " + number + " minute" + (number !== "1" ? "s" : "") + ".</span>";
}
}
$("#timing-container").html("Last updated at " + lastUpdateTime.format('HH:mm') + " UTC. " + updatingString);
}
}
// When the "use local time" field is changed, reload the table and save settings
function timeZoneUpdated() {
updateTable();