How to wait in javascript?

Publié le: 01 janvier 1970
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne How to wait in javascript? durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur GamerMan 01 janvier 1970, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 54 fois et il a aimé 1 téléspectateurs. Bon visionnage!