Re: [whatwg/streams] Support teeing readable byte streams (#1114)

@MattiasBuelens commented on this pull request.



> +        if (branch2._controller._pendingPullIntos.length > 0) {
+          ReadableByteStreamControllerRespond(branch2._controller, 0);
+        }
+        resolvePromise(cancelPromise, undefined);
+      },
+      errorSteps: () => {
+        reading = false;
+      }
+    };
+    ReadableStreamDefaultReaderRead(reader, readRequest);
+  }
+
+  function pullWithBYOBReader(view, forBranch2) {
+    if (ReadableStreamDefaultReader.isImpl(reader)) {
+      assert(reader._readRequests.length === 0);
+      ReadableStreamReaderGenericRelease(reader);

Yup! I've done something similar before in [web-streams-adapter](https://github.com/MattiasBuelens/web-streams-adapter/blob/v0.1.0-alpha.5/src/readable-wrapper.ts#L235-L257), so that's where I got the idea. 😁

-- 
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/1114#discussion_r601877969

Received on Thursday, 25 March 2021 22:27:21 UTC