diff --git a/client.js b/client.js
index 60ef6a6..f772b65 100644
--- a/client.js
+++ b/client.js
@@ -10,6 +10,27 @@ Notification.requestPermission(permission => {
}
});
+function redrawTable() {
+ let table = document.querySelector('table.calls');
+ table.innerHTML =
+ `
Callsign | ` +
+ `Last Heard | ` +
+ `Time since Last Heard | `;
+ for (let callsign in calls) {
+ let call = calls[callsign];
+ let nowDelta = new Date(new Date() - call.lastHeard);
+
+ let tr = table.appendChild(document.createElement('tr'));
+ if (nowDelta.getTime() > timeoutLength) {
+ tr.classList.add('timedOut');
+ }
+ tr.innerHTML =
+ `${callsign} | ` +
+ `${call.lastHeard.toLocaleTimeString('en-GB')} | ` +
+ `${nowDelta.toLocaleTimeString('en-GB', {timeZone: "UTC"})} | `
+ ;
+ }
+}
function alertNotHeard(callsign) {
new Notification(`${callsign} has not been heard for 20 Minutes!`,
@@ -38,5 +59,9 @@ aprsStream.onmessage = function(event) {
calls[callsign].delta = date - calls[callsign].lastHeard;
calls[callsign].timeout = window.setTimeout(
alertNotHeard, timeoutLength, callsign);
+
+ redrawTable();
};
+window.addEventListener("load", redrawTable);
+window.setInterval(redrawTable, 1000);
diff --git a/index.html b/index.html
index 435728f..0f78c9c 100644
--- a/index.html
+++ b/index.html
@@ -1,11 +1,23 @@
+
---|