Add support for different statistic counters

This commit is contained in:
logicog
2025-08-21 16:12:59 +02:00
parent 7968b03c57
commit ae80aa1017
3 changed files with 49 additions and 6 deletions
+17
View File
@@ -23,4 +23,21 @@ function fillStats() {
}
}
function getCounts() {
for (let port = 1; port <= numPorts; port++) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
const s = JSON.parse(xhttp.responseText);
console.log("Counters: ", JSON.stringify(s));
}
}
xhttp.open("GET", `/counters.json?port=${port}`, true);
xhttp.send();
}
}
window.addEventListener("load", function() {
const iCount = setInterval(getCounts, 1000);
});
const stat = setInterval(fillStats, 500);