Async/ await is cool feature in JavaScript. Much has been written about it. In this post I would like to show how to resolve more independent async functions calls.
Let's have a simple promise call. It takes 1 second.
Now we will call the function multiple times using await. It takes aproximately 10 seconds.
When our asynchronous function is independent, it is useful to use Promise.all() instead of await. It fulfilled all promises in time approximately 1 second.
No comments:
Post a Comment