Skip to content

Instantly share code, notes, and snippets.

@x2764tech
Last active October 9, 2019 15:12
Show Gist options
  • Save x2764tech/fe1fbf9c299ad54814ca252e2a33b405 to your computer and use it in GitHub Desktop.
Save x2764tech/fe1fbf9c299ad54814ca252e2a33b405 to your computer and use it in GitHub Desktop.
delay function for using in promise
/***
* 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