For await syntax
See original GitHub issueGiven that the for await syntax is a thing now, I think it would be very useful if the .each()
method returned an async iterator instead of using a classical callback.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:10 (1 by maintainers)
Top Results From Across the Web
for await...of - JavaScript - MDN Web Docs
The for await...of statement creates a loop iterating over async iterable objects as well as sync iterables. This statement can only be used ......
Read more >for await...of - JavaScript - UDN Web Docs: MDN Backup
The for await...of statement creates a loop iterating over async iterable objects as well as on sync iterables, including: built-in String , Array...
Read more >Async/await - The Modern JavaScript Tutorial
The syntax: // works only inside async functions let value = await promise ...
Read more >for await of VS Promise.all - javascript - Stack Overflow
for await is wrong, Promise.all is the only correct way to deal with this situation where you have multiple promises that you need...
Read more >for await loops (Part I)
A feature of other languages - like JavaScript for example - and of the macro-based futures-async-await prototype is a syntax for writing for ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is difficult because the row callback for
each
is synchronous, butfor await
would require an aync callback (even if you don’t actually use any async methods in thefor
body). To achieve this result you’d have to keep each row in a queue and wait for the row callback to finish before emitting the next result.Something like this should do it:
Why is there not a completed callback? An async queue is easy to do myself but I need to know when to end.
Edit: Sorry, just found the db property