Created
April 8, 2019 15:50
-
-
Save majindageta/a8776c4c11d054459398d1a7a3bad207 to your computer and use it in GitHub Desktop.
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
let string = ''; | |
let counter = 0; | |
const start = async () => { | |
await Promise.all(data.Contents.map(async element => { | |
string += await someAsyncFunc(element); | |
console.log('Counter: ' + counter); | |
counter++; | |
})) | |
console.log('Finishing'); | |
doSomethingAfterThat(string); | |
} | |
start(); | |
async function someAsyncFunc(data: string) { | |
return new Promise((resolve, reject) => { | |
//wait.... | |
resolve('asd'); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment