Skip to content

Instantly share code, notes, and snippets.

@hyzhak
Created November 30, 2018 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyzhak/2d8c4aafdbfde18fc797cb73250a7758 to your computer and use it in GitHub Desktop.
Save hyzhak/2d8c4aafdbfde18fc797cb73250a7758 to your computer and use it in GitHub Desktop.
next tick promise build which could be used when we need to wait before next portion of async calls
/**
* Create next trick promise which could be used:
*
* lazyAction()
* .then(nextTick())
* .then(doSomethingElse)
*
* @returns {Promise}
*/
module.exports = () => new Promise(resolve => process.nextTick(resolve))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment