Created
January 24, 2019 07:59
-
-
Save iamrommel/d43058f95ba37b0b9792a4eaa2834827 to your computer and use it in GitHub Desktop.
Sample of using async/await in loops with promise.all
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
async function updateAllCustomer(customers) { | |
const mapsPromises = customers.map(update); | |
//this will wait until all promise is resolved before going to next line | |
await Promise.all(mapsPromises); | |
console.log('Done!'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment