Skip to content

Instantly share code, notes, and snippets.

@DannyFeliz
Last active August 4, 2018 03:43

Revisions

  1. DannyFeliz revised this gist Aug 4, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion timeout.js
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,6 @@ function runTimeout(timeout) {
    resolve();
    }, timeout);
    });
    }
    }

    initInterval();
  2. DannyFeliz revised this gist Aug 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion timeout.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    var timeoutList = [5000, 2500, 4500];
    const timeoutList = [5000, 2500, 4500];

    async function initInterval() {
    for(const timeout of timeoutList) {
  3. DannyFeliz created this gist Aug 4, 2018.
    16 changes: 16 additions & 0 deletions timeout.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    var timeoutList = [5000, 2500, 4500];

    async function initInterval() {
    for(const timeout of timeoutList) {
    await runTimeout(timeout);
    }
    }

    function runTimeout(timeout) {
    return new Promise(resolve => {
    setTimeout(() => {
    console.log("Run =>", timeout);
    resolve();
    }, timeout);
    });
    }