- From: Romain <notifications@github.com>
- Date: Thu, 09 Mar 2017 06:37:04 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 9 March 2017 14:37:46 UTC
Hi @domenic, no problem for the delay. If I understand the spec correctly, below sample leads to calling ReadableByteStreamControllerRespondInClosedState with a default reader.
```javascript
// First create a ReadableStream with a ReadableByteStreamController
// and a specific value for autoAllocateChunkSize.
let controller;
const rs = new ReadableStream({
autoAllocateChunkSize: 128,
start: function(c) {
controller = c;
},
type: "bytes"
});
// As autoAllocateChunkSize is defined, calling read() leads to adding
// an item to controller.pendingPullIntos through controller pull() method.
rs.getReader().read();
// Hence, byobRequest can be obtained (step 2 of "get byobRequest").
const br = controller.byobRequest;
controller.close();
// Stream has been closed prior to calling respond() and bytesWritten value
// is 0: therefore, ReadableByteStreamControllerRespondInClosedState is called.
br.respond(0);
```
--
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/686#issuecomment-285368195
Received on Thursday, 9 March 2017 14:37:46 UTC