- From: Timothy Gu <notifications@github.com>
- Date: Tue, 21 Aug 2018 08:48:18 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/950/review/148119928@github.com>
TimothyGu commented on this pull request. > + <tr> + <th>Internal Slot</th> + <th>Description (<em>non-normative</em>)</th> + </tr> + </thead> + <tr> + <td>\[[Reader]] + <td class="non-normative">A {{ReadableStreamDefaultReader}} instance. + </tr> + <tr> + <td>\[[Cancel]] + <td class="non-normative">Boolean value indicating if the reader will be cancelled when the stream returns. + </tr> +</table> + +<h5 id="default-reader-asynciterator-prototype-next" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype"> This and `return()` should be `<h4>`'s. > @@ -1402,6 +1405,87 @@ lt="ReadableStreamDefaultReader(stream)">new ReadableStreamDefaultReader(<var>st 1. Perform ! ReadableStreamReaderGenericRelease(*this*). </emu-alg> +<h5 id="default-reader-iterator" method for="ReadableStreamDefaultReader"> + iterator({ cancel = true } = {}) There is no precedent for an `iterator` method anywhere in the platform and I'm reluctant to start that now. Just having `@@asyncIterator` is good enough IMO. > + <td>\[[Reader]] + <td class="non-normative">A {{ReadableStreamDefaultReader}} instance. + </tr> + <tr> + <td>\[[Cancel]] + <td class="non-normative">Boolean value indicating if the reader will be cancelled when the stream returns. + </tr> +</table> + +<h5 id="default-reader-asynciterator-prototype-next" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype"> + next() +</h5> + +<emu-alg> + 1. Let _O_ be *this* value. + 1. If Type(_O_) is not Object, throw a *TypeError* exception. 1. This needs to check if _O_ has a [[Reader]] internal slot. Otherwise _O_ might not be a ReadableStreamDefaultReaderAsyncIterator. It might be worthwhile to have an IsReadableStreamDefaultReaderAsyncIterator abstract operation. 2. This spec uses **this** rather "**this** value" (the ECMA-262 convention). So you could just do Type(**this**). Ditto below for cancel. > + <td class="non-normative">A {{ReadableStreamDefaultReader}} instance. + </tr> + <tr> + <td>\[[Cancel]] + <td class="non-normative">Boolean value indicating if the reader will be cancelled when the stream returns. + </tr> +</table> + +<h5 id="default-reader-asynciterator-prototype-next" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype"> + next() +</h5> + +<emu-alg> + 1. Let _O_ be *this* value. + 1. If Type(_O_) is not Object, throw a *TypeError* exception. + 1. Let _reader_ be O.[[Reader]]. Missing \_ for O. > + </tr> + <tr> + <td>\[[Cancel]] + <td class="non-normative">Boolean value indicating if the reader will be cancelled when the stream returns. + </tr> +</table> + +<h5 id="default-reader-asynciterator-prototype-next" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype"> + next() +</h5> + +<emu-alg> + 1. Let _O_ be *this* value. + 1. If Type(_O_) is not Object, throw a *TypeError* exception. + 1. Let _reader_ be O.[[Reader]]. + 1. Let _read_ be ? GetMethod(_reader_, "read"). `"read"` Ditto below for cancel. > + <tr> + <td>\[[Cancel]] + <td class="non-normative">Boolean value indicating if the reader will be cancelled when the stream returns. + </tr> +</table> + +<h5 id="default-reader-asynciterator-prototype-next" method for="ReadableStreamDefaultReaderAsyncIteratorPrototype"> + next() +</h5> + +<emu-alg> + 1. Let _O_ be *this* value. + 1. If Type(_O_) is not Object, throw a *TypeError* exception. + 1. Let _reader_ be O.[[Reader]]. + 1. Let _read_ be ? GetMethod(_reader_, "read"). + 1. Return ? Call(_read_, _reader_); s/;/. > +</emu-alg> + +<h5 id="default-reader-@@asynciterator" for="ReadableStreamDefaultReader">[@@asyncIterator]()</h5> + +<div class="note"> + The <code>@@asyncIterator</code> method is an alias of {{ReadableStreamDefaultReader/iterator}}. +</div> + +<emu-alg> + 1. Let _iterator_ be ? GetMethod(*this*, "iterator"). + 1. Return ? Call(_iterator_, *this*). +</emu-alg> + +<h3 id="default-reader-asynciterator-prototype" interface lt="ReadableStreamDefaultReaderAsyncIteratorPrototype"> + ReadableStreamDefaultReaderAsyncIteratorPrototype +</h3> It should be written somewhere that this inherits from [%AsyncIteratorPrototype%](https://tc39.github.io/ecma262/#sec-asynciteratorprototype). > @@ -1402,6 +1405,87 @@ lt="ReadableStreamDefaultReader(stream)">new ReadableStreamDefaultReader(<var>st 1. Perform ! ReadableStreamReaderGenericRelease(*this*). </emu-alg> +<h5 id="default-reader-iterator" method for="ReadableStreamDefaultReader"> + iterator({ cancel = true } = {}) +</h5> + +<div class="note"> + The <code>iterator</code> method returns an async iterator which can be used to consume the stream. The return method The `return` method > @@ -1402,6 +1405,87 @@ lt="ReadableStreamDefaultReader(stream)">new ReadableStreamDefaultReader(<var>st 1. Perform ! ReadableStreamReaderGenericRelease(*this*). </emu-alg> +<h5 id="default-reader-iterator" method for="ReadableStreamDefaultReader"> + iterator({ cancel = true } = {}) +</h5> + +<div class="note"> + The <code>iterator</code> method returns an async iterator which can be used to consume the stream. The return method + of this iterator will optionally release or cancel this reader. 1. this iterator object 2. Link [release](https://streams.spec.whatwg.org/#release-a-lock) and maybe [cancel](https://streams.spec.whatwg.org/#cancel-a-readable-stream) too? -- 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/pull/950#pullrequestreview-148119928
Received on Tuesday, 21 August 2018 15:48:40 UTC