Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
krisdol
on May 30, 2017
|
parent
|
context
|
favorite
| on:
Node v8.0.0 Released
You can use .map to call await on every element in the array, or define a new function so you don't have to write that all the time:
const awaitAll = (futures) => futures.map(f => await f);
edit: this is wrong but I can't delete it. Haven't used async as much as promises.
ujal
on May 30, 2017
|
next
[–]
Well an async function always returns a Promise. await simply blocks until the Promise is resolved to continue execution. Thats why I am wondering why they decided to await only on a single Promise.
ujal
on May 30, 2017
|
prev
[–]
Don't you need to be in an async context to call await?
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: