Re: [whatwg/streams] ReadableStream should be an async iterable (#778)

Auto-cancelling and auto-releasing should suffice for a base implementation. 

FWIW [this code](https://gist.github.com/guest271314/74d3a2aa765330163eecc46e16a52acd) began with an attempt to place a possibly infinite `Promise` chain within a [`while` expression](https://stackoverflow.com/q/47171474). A `Map` object is used for the purpose of dynamically adding elements to be iterated (from perspective here, the default implementation of trying to pass a dynamic value to `next().then()` is difficult to arrage; we would first need define the value of `yield` as a variable and use an addition line or two for `if..else` within the generator function). A flag is used which should stop iteration immediately. The iteration can also be stopped by returning or throwing. All errors should reach and be handled at the last chained `.catch()` after propagating through the previous `.catch()`s, though that can be adjusted to continue processing if a `Promise` is rejected within process.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/778#issuecomment-371854372

Received on Friday, 9 March 2018 15:59:49 UTC