Created
November 13, 2017 14:09
-
-
Save tanepiper/e7f422ea08429eb9a12f4dfcb7d7060a to your computer and use it in GitHub Desktop.
A JS sleep function that can also call a passed function
This file contains hidden or 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 = (ms, caller, ...args) => new Promise(resolve => setTimeout(caller || resolve, ms, ...args)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment