Last active
July 14, 2022 13:46
-
-
Save abcdeepakr/b2d14773fe63dccfe7b0b1656ce89af9 to your computer and use it in GitHub Desktop.
delay for loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const timer = ms => new Promise(res => setTimeout(res, ms)) | |
async function load () | |
{ | |
for (var i = 0; i < 100; i++) { | |
// write the logic here, make api calls or anything | |
await timer(550); // will go into the next one after 550ms | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment