Server: If-Modified-Since, block bis Änderung; Client: sofortiger Re-Poll
This commit is contained in:
11
app.js
11
app.js
@@ -440,13 +440,12 @@ function startAutoRefresh() {
|
||||
document.getElementById('refresh-timer').textContent = '● Live';
|
||||
document.getElementById('refresh-timer').style.color = '#4ade80';
|
||||
|
||||
async function poll() {
|
||||
while (true) {
|
||||
const myId = ++pollId;
|
||||
(async function poll() {
|
||||
while (pollId === myId) {
|
||||
await loadPGN(false);
|
||||
await new Promise(r => setTimeout(r, 30000));
|
||||
}
|
||||
}
|
||||
poll();
|
||||
})();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,7 +469,7 @@ function hideError() {
|
||||
*/
|
||||
document.getElementById('refresh-btn').addEventListener('click', () => {
|
||||
pollId++;
|
||||
loadPGN(true);
|
||||
loadPGN(true).then(() => startAutoRefresh());
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user