How to wait in javascript?

Pubblicato il: 01 gennaio 1970
sul canale di: GamerMan
54
1

I this video i show you how to make a wait function(because there is no built in one).

Code:

async function waitUntil(conditionFunction, interval = 100) {
while (!conditionFunction()) {
await new Promise(resolve = /**add an angled bracket here**\ setTimeout(resolve, interval));
}
}

async function wait(time) {
await new Promise(resolve = /**add an angled bracket here**\ setTimeout(resolve, time*1000));
}

Chapters:

0:00 - 0:49 - Intro
0:50 - 1:37 - Wait Until
1:38 - 2:07 - Wait
2:08 - 2:24 - Outro


In questa pagina del sito puoi guardare il video online How to wait in javascript? della durata di ore minuti seconda in buona qualità , che l'utente ha caricato GamerMan 01 gennaio 1970, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 54 volte e gli è piaciuto 1 spettatori. Buona visione!