abtmtr-v4/views/projects/item/clock/update.js

24 lines
666 B
JavaScript
Raw Normal View History

2023-12-07 16:34:09 +00:00
function reqData(start) {
console.log("Pinged API server. Starting: " + start);
var donedata = (e) => {
var resp = e;
var prevSha = "A";
if (!start) prevSha = window.sessionStorage.getItem("commitsha");
if (resp != prevSha) {
window.sessionStorage.setItem("commitsha", resp);
if (start) return;
document.querySelector("#updatesha").innerHTML = `from job v. ${prevSha} to job v. ${resp}`;
document.querySelector("#updatedialog").classList.add("open");
}
};
fetch("https://ClockCheckGithub.meowcatheorange.repl.co")
.then(x => x.text())
.then(y => donedata(y));
}
setInterval(reqData, 60000);
reqData(true);