Created
October 14, 2022 12:56
-
-
Save ShivamJoker/dafe821cae2ff8076eaf132b45f744aa to your computer and use it in GitHub Desktop.
Simple JavaScript promise based function to add delay between your executions
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 sleep = (duration) => { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(); | |
}, duration); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment