Re: [whatwg/streams] Allow other specifications to create readable byte streams (#1130)

@ricea approved this pull request.

lgtm

>  
-  1. Let |readableStream| be a [=new=] {{ReadableStream}}.
-  1. [=ReadableStream/Set up=] |readableStream| given….
- </div>
+ 1. Let |startAlgorithm| be an algorithm that returns undefined.
+ 1. Let |pullAlgorithmWrapper| be an algorithm that runs these steps:
+  1. If |pullAlgorithm| was given, run it.
+  1. Return [=a promise resolved with=] undefined.

TODO: support returning a promise as with https://github.com/whatwg/streams/pull/1131


> + To <dfn export for="ReadableStream">enqueue bytes</dfn> into a {{ReadableStream}} |stream| given a
+ [=byte sequence=] |bytes|:
+
+ 1. Assert: |stream|.[=ReadableStream/[[controller]]=] [=implements=]
+    {{ReadableByteStreamController}}.
+ 1. Assert: |bytes|'s [=byte sequence/length=] is positive.
+ 1. Let |byobRequest| be !
+    [$ReadableByteStreamControllerGetBYOBRequest$](|stream|.[=ReadableStream/[[controller]]=]).
+ 1. If |byobRequest| is null, or
+    |byobRequest|.[=ReadableStreamBYOBRequest/[[view]]=].\[[ByteLength]] &lt; |bytes|'s [=byte
+    sequence/length=], then:
+  1. Let |uint8Array| be a new {{Uint8Array}} wrapping an {{ArrayBuffer}} backed by |bytes|.
+  1. Perform ! [$ReadableByteStreamControllerEnqueue$](|stream|.[=ReadableStream/[[controller]]=],
+     |uint8Array|).
+ 1. Otherwise,
+  1. Write |bytes| into

Do we need an assertion that it will fit?

-- 
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/1130#pullrequestreview-675944515

Received on Friday, 4 June 2021 06:17:57 UTC