Re: [streams] WIP: exclusive reader interface (#251)

> +  The <code>getReader</code> method creates an <a>exclusive stream reader</a> and
> +  <a title="locked to a reader">locks</a> the stream to the the new reader. While the stream is locked, it cannot be
> +  manipulated directly, and will appear to be an inert, empty stream waiting for new <a>chunks</a> to be enqueued.
> +  Instead, the returned reader object can be used to read from or cancel the stream, or to discern its state and state
> +  transitions. If or when the lock is <a title="release a read lock">released</a>, the stream can be used again as
> +  normal.
> +
> +  This functionality is especially useful for creating abstractions that desire the ability to consume a stream in its
> +  entirety. By getting a reader for the stream, you can ensure nobody else can interleave reads with yours, interfering
> +  with your abstraction or observing its side-effects.
> +</div>
> +
> +<ol>
> +  <li> Return Construct(<code>ExclusiveStreamReader</code>, (<b>this</b>)).
> +</ol>
> +

Throws when the state is "closed" or "errored" is good. Otherwise, "closed -> waiting" and "errored -> waiting" state transition will be observed.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/251/files#r21820970

Received on Monday, 15 December 2014 12:42:21 UTC