You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

27 lines
476 B

/*
 * Fonction pour introduire une attente
 * usage : await delai(1000);
 */
function delai(milliseconds){
    return new Promise(resolve => {
        setTimeout(resolve, milliseconds);
    });
}
var waitLoop = (ms) => {
    const start = Date.now();
    let now = start;
    while (now - start < ms) {
      now = Date.now();
    }
}
async function attendre1(milliseconds)
{
    await delai(milliseconds);
}
function attendre(milliseconds)
{
    waitLoop(milliseconds);
}