blob: 25f549a40c2a8c45f3319845fa724d9667534f17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
async function updateUptime() {
try {
const res = await fetch("/api/my-uptime");
if (!res.ok) return;
const data = await res.json();
const text = document.getElementById("Uptime");
if (text && text.textContent !== data.uptime) {
text.textContent = data.uptime;
}
} catch (e) {}
}
// Run on page load after all DOM elements loaded
DOMContentLoaded(updateUptime());
setInterval(updateUptime, 5 * 1000); // in ms
|