Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created January 26, 2016 23:17
Show Gist options
  • Select an option

  • Save bcomnes/d0f02beb0bfdaf2ff023 to your computer and use it in GitHub Desktop.

Select an option

Save bcomnes/d0f02beb0bfdaf2ff023 to your computer and use it in GitHub Desktop.
function asyncTest (cb) {
setTimeout(
function () {
console.log('waited 5 seconds')
setTimeout(function () {
console.log('waited 3 seconds')
cb()
}, 3000)
}, 5000)
}
console.log('starting')
setImmediate(asyncTest, function () { console.log('done1') })
setImmediate(asyncTest, function () { console.log('done2') })
setImmediate(asyncTest, function () { console.log('done3') })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment