Re: [streams] Byte stream update, including reference implementation (#361)

> +  }).catch(e => {
> +    t.fail(e);
> +    t.end();
> +  });
> +});
> +
> +test('ReadableByteStream: read(), then respond()', t => {
> +  let controller;
> +
> +  const rbs = new ReadableByteStream({
> +    start(c) {
> +      controller = c;
> +    },
> +    pull() {
> +      try {
> +        controller.respond(1);

> Oh gah I now realize that the second buffer argument is optional. Hmm, we'll need to work through the transfer story in a bit more detail, but we can leave that for later.

This is a side effect of https://github.com/whatwg/streams/issues/353#issuecomment-111045309. I stored the buffer inside the controller to get prepared for `enqueue()` call in response to `pullInto()`. So, we don't have to receive the buffer from the underlying byte source (only if the underlying byte source hasn't detached it. in such cases, it must pass the active buffer to `respond()`).

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

Received on Tuesday, 16 June 2015 10:24:40 UTC