0
How can I perform three functions within the same setInterval, and for one the time to update should be different.
I tried the following:
function sleep(ms) {
return new Promise(resolve => setInterval(resolve, ms));
}
async function update() {
for($i=0;$i<300;$i++){ // a cada 300x (5min) faz um refresh
atualizaLeilao();
atualizaLeilaoCancelado();
updateClock();
await sleep(1000);
}
location.reload();
}
$(document).ready(function () {
update();
});
I need that function atualizaLeilaoCancelado();
is updated every 5 minutes, not every second.
Wendler, sorry for my comment without knowing your application as a whole, but isn’t there a logic flaw there? Unless you put a setInterval inside the other all will run at the same time, so this code snippet would be simpler to create 3 setIntervals there.
– Marcelo