watchyourlan/internal/web/public/js/refresh.js
2024-08-28 13:59:48 +07:00

21 lines
No EOL
394 B
JavaScript

let ref = false;
let refInterval;
autoRefresh();
function toggleRefresh() {
ref = !ref;
autoRefresh()
}
function autoRefresh() {
if (ref) {
const timeout = document.getElementById("ref-timeout").value;
console.log("Refresh timeout", timeout);
refInterval = setInterval(loadAddrs, timeout * 1000);
} else {
clearInterval(refInterval);
}
}