Y
Hacker News
new
|
ask
|
show
|
jobs
by
fregante
1733 days ago
`for await` is for async iterables, which is different. The loop body will still block the loop. Compare it to the all/map example I wrote.
1 comments
eurasiantiger
1733 days ago
True, it is sequential and not parallel. I think this syntax with an async generator could be made to do what you seek.
link
fregante
1732 days ago
Async iterables are async generators. They call .next() on the iterable, that returns a promise, the promise resolves with either a new item to loop with, or with `done`, which will stop the loop.
link