189 build - уменьшинно количество запросов для одновременной работы на 2х матчах

This commit is contained in:
2026-10-02 18:39:15 +03:00
parent 74249d7fa2
commit e4bedb1264
10 changed files with 556 additions and 128 deletions

View File

@@ -260,8 +260,9 @@
`;
}
async function load(force = false) {
if (state.loading && !force) return;
async function load(force = false, { bootstrap = false } = {}) {
if (!state.open && !bootstrap) return;
if (state.loading) return;
const requestId = ++state.requestId;
state.loading = true;
render();
@@ -283,10 +284,12 @@
function schedule() {
if (state.timer) window.clearTimeout(state.timer);
state.timer = null;
if (!state.open) return;
state.timer = window.setTimeout(async () => {
if (!document.hidden) await load();
if (state.open && !document.hidden) await load();
schedule();
}, state.open ? 2000 : 5000);
}, 2000);
}
window.addEventListener("hockey:agent-selected", () => {
@@ -304,6 +307,6 @@
});
ensureRoot();
load(true);
load(true, { bootstrap: true });
schedule();
})();