Skip to content

Instantly share code, notes, and snippets.

@delucis
Created November 13, 2017 15:31
Show Gist options
  • Save delucis/df9dc09870861deceb4d4134b81ebe76 to your computer and use it in GitHub Desktop.
Save delucis/df9dc09870861deceb4d4134b81ebe76 to your computer and use it in GitHub Desktop.
Asynchronous, parallel loops ➰➰➰
// ES7 with async/await and Promise.all
async function loopIt(array) {
await Promise.all(array.map(async member => {
// asyncStuff() will be called in parallel for all array members
let result = await asyncStuff(member)
}))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment