Last active
October 9, 2019 15:12
-
-
Save x2764tech/fe1fbf9c299ad54814ca252e2a33b405 to your computer and use it in GitHub Desktop.
delay function for using in promise
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
/*** | |
* usage: | |
* p.then(delay(milliseconds)).then(r => ....) | |
* | |
* why? mostly testing | |
* | |
*/ | |
export default const (millisecondDelay) => (result) => new Promise(resolve => setTimeout(() => resolve(result), millisecondDelay)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment