Re:Mistakes we make using JavaScript Promises
by pault on Friday July 05, 2019 @10:33AM
(#20362788)
That's fine, but you'll still only be able to block on one promise at a time. If you want to wait until all promises have resolved you still have to use Promise. all.
[ Parent
| on HN ]
Re:Mistakes we make using JavaScript Promises
by Nullabillity on Friday July 05, 2019 @12:29PM
(#20363741)
Promises are started eagerly, so
const xP = getX();
const yP = getY();
const x = await xP;
const y = await yP;
is just as parallel as const [x, y] = Promise.all([getX(), getY()]);