189 build - уменьшинно количество запросов для одновременной работы на 2х матчах
This commit is contained in:
@@ -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();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user