- From: Kurt Mackey <notifications@github.com>
- Date: Wed, 21 Feb 2018 23:24:23 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 21 February 2018 23:24:47 UTC
Ah! Ok that makes things a little clearer.
It might be a pull! Pull happens immediately when I create a readable stream, however, and what I really want is for it to do nothing at instantiation time, then do a lot as soon as it's read from. Is this a gross hack or does it fit the spirit of the spec?
```
let data = [1,2,3,4,5]
let pullCalled = false
let s = new ReadableStream({
start(controller){ console.log("started") },
pull(controller){
if(!pullCalled){
console.log("first pull noop")
pullCalled = true
}
else if(pullCalled && data.length > 0){
let i = data.shift()
controller.enqueue(i)
console.log(i)
}
}
})
```
--
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/889#issuecomment-367512955
Received on Wednesday, 21 February 2018 23:24:47 UTC