Skip to content

Instantly share code, notes, and snippets.

@sharjeel619
Last active March 21, 2024 21:39
Show Gist options
  • Select an option

  • Save sharjeel619/332f190aadbc8309312a54e7739960c2 to your computer and use it in GitHub Desktop.

Select an option

Save sharjeel619/332f190aadbc8309312a54e7739960c2 to your computer and use it in GitHub Desktop.

Revisions

  1. sharjeel619 revised this gist Mar 21, 2024. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,12 @@
    // These examples Block UI
    let startTime = performance.now();
    while (performance.now() - startTime < 500) {
    // // Do nothing for 500 ms to emulate extremely slow code
    }
    }

    const wait = (ms) => {
    const start = Date.now();
    let now = start;

    while (now - start < ms) now = Date.now();
    }
  2. sharjeel619 created this gist Aug 10, 2023.
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    let startTime = performance.now();
    while (performance.now() - startTime < 500) {
    // // Do nothing for 500 ms to emulate extremely slow code
    }