aboutsummaryrefslogtreecommitdiff
path: root/static/scripts/auto_refresh.js
blob: 20fc5c60aab418aa4e188cdaa201c2965ae611e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(() => {
    const UPDATE_INTERVAL_MILLISECONDS = 1 * 60 * 1000; // 1 minute
    setInterval(async () => {
        const response = await fetch(window.location);
        if (!response.ok) {
            return;
        }
        const responseText = await response.text();

        const parser = new DOMParser();
        const newDoc = parser.parseFromString(responseText, "text/html");
        document.querySelector("table").innerHTML = newDoc.querySelector("table").innerHTML;
    }, UPDATE_INTERVAL_MILLISECONDS);
})();