- From: Yiqi Yan <notifications@github.com>
- Date: Thu, 08 Aug 2019 17:59:22 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 9 August 2019 00:59:44 UTC
Thanks a lot @MattiasBuelens ~ One follow-up question: is there any way to change your code such that no async/await is used (for code-style reason)? I tried as follows but did not work. ``` waitForData() { return new Promise( (resolve) => { if (this.position < this.source.length) { resolve(); } else { return this.waitForData(); } } ) } append(newChunks) { this.source.push(...newChunks); } pull(controller: ReadableByteStreamController) { return this.waitForData().then( () => { const view = controller.byobRequest.view; view[0] = this.source[this.position++]; controller.byobRequest.respond(1); } ); } ``` -- 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/1008#issuecomment-519738903
Received on Friday, 9 August 2019 00:59:44 UTC