6

Til that Node 10 has `for await ... in`. Basically looping async iterators. This changes everything!

Comments
  • 2
    Too bad Node.js standard library is heavily callback based
  • 1
    @joas Well yeah. Promisify yaay
  • 2
    @irene it's mostly useful for stream of information that would block if a recv call was made. The event loop likely reschedules another task if io is not ready.
  • 0
    @irene Does it actually make it synchronus? It acts like any awaited call, right?

    EDIT: Nice avatar btw
  • 1
    @irene No, it only blocks the execution in the scope of the async block. Then that block may bubble up to any calling functions, but as long as the initial async call is handled correctly there will be no blocking. As a matter of the fact, the main thread can't be async, which means that it can't be blocked by an async call.
Add Comment