20 lines
604 B
JavaScript
20 lines
604 B
JavaScript
const output = document.querySelector("#run-output");
|
|
|
|
if (output) {
|
|
const refresh = async () => {
|
|
const response = await fetch(output.dataset.outputUrl, { cache: "no-store" });
|
|
if (response.ok) {
|
|
output.textContent = (await response.json()).output;
|
|
}
|
|
const status = document.querySelector("#run-status");
|
|
if (status) {
|
|
const stateResponse = await fetch(status.dataset.stateUrl, { cache: "no-store" });
|
|
if (stateResponse.ok) {
|
|
status.textContent = (await stateResponse.json()).status;
|
|
}
|
|
}
|
|
};
|
|
refresh();
|
|
window.setInterval(refresh, 2000);
|
|
}
|