Skip to content

Commit 03ba502

Browse files
committed
Add <div algorithm>
1 parent 12f1e28 commit 03ba502

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

index.bs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,32 @@ CompressionStream includes GenericTransformStream;
7979

8080
A {{CompressionStream}} has an associated <dfn for=CompressionStream>format</dfn> and <a>compression context</a> <dfn for=CompressionStream>context</dfn>.
8181

82+
<div algorithm>
8283
The <dfn constructor for=CompressionStream lt="CompressionStream(format)"><code>new CompressionStream(|format|)</code></dfn> steps are:
8384
1. If |format| is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
8485
1. Set [=this=]'s <a for=CompressionStream>format</a> to |format|.
8586
1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the <a>compress and enqueue a chunk</a> algorithm with [=this=] and |chunk|.
8687
1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with [=this=].
8788
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=] {{TransformStream}}.
8889
1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to |transformAlgorithm| and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to |flushAlgorithm|.
90+
</div>
8991

92+
<div algorithm>
9093
The <dfn>compress and enqueue a chunk</dfn> algorithm, given a {{CompressionStream}} object |cs| and a |chunk|, runs these steps:
9194
1. If |chunk| is not a {{BufferSource}} type, then throw a {{TypeError}}.
9295
1. Let |buffer| be the result of compressing |chunk| with |cs|'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>.
9396
1. If |buffer| is empty, return.
9497
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
9598
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |cs|'s [=GenericTransformStream/transform=].
99+
</div>
96100

101+
<div algorithm>
97102
The <dfn>compress flush and enqueue</dfn> algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{CompressionStream}} object |cs|, runs these steps:
98-
99103
1. Let |buffer| be the result of compressing an empty input with |cs|'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>, with the finish flag.
100104
1. If |buffer| is empty, return.
101105
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
102106
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |cs|'s [=GenericTransformStream/transform=].
107+
</div>
103108

104109

105110
# Interface `DecompressionStream` # {#decompression-stream}
@@ -114,28 +119,32 @@ DecompressionStream includes GenericTransformStream;
114119

115120
A {{DecompressionStream}} has an associated <dfn for=DecompressionStream>format</dfn> and <a>compression context</a> <dfn for=DecompressionStream>context</dfn>.
116121

122+
<div algorithm>
117123
The <dfn constructor for=DecompressionStream lt="DecompressionStream(format)"><code>new DecompressionStream(|format|)</code></dfn> steps are:
118124
1. If |format| is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
119125
1. Set [=this=]'s <a for=DecompressionStream>format</a> to |format|.
120126
1. Let |transformAlgorithm| be an algorithm which takes a |chunk| argument and runs the <a>decompress and enqueue a chunk</a> algorithm with [=this=] and |chunk|.
121127
1. Let |flushAlgorithm| be an algorithm which takes no argument and runs the <a>decompress flush and enqueue</a> algorithm with [=this=].
122128
1. Set [=this=]'s [=GenericTransformStream/transform=] to a [=new=] {{TransformStream}}.
123129
1. [=TransformStream/Set up=] [=this=]'s [=GenericTransformStream/transform=] with <i>[=TransformStream/set up/transformAlgorithm=]</i> set to |transformAlgorithm| and <i>[=TransformStream/set up/flushAlgorithm=]</i> set to |flushAlgorithm|.
130+
</div>
124131

132+
<div algorithm>
125133
The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a {{DecompressionStream}} object |ds| and a |chunk|, runs these steps:
126134
1. If |chunk| is not a {{BufferSource}} type, then throw a {{TypeError}}.
127135
1. Let |buffer| be the result of decompressing |chunk| with |ds|'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>. If this results in an error, then throw a {{TypeError}}.
128136
1. If |buffer| is empty, return.
129137
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
130138
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
131139

140+
<div algorithm>
132141
The <dfn>decompress flush and enqueue</dfn> algorithm, which handles the end of data from the input {{ReadableStream}} object, given a {{DecompressionStream}} object |ds|, runs these steps:
133-
134142
1. Let |buffer| be the result of decompressing an empty input with |ds|'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>, with the finish flag.
135143
1. If the end of the compressed input has not been reached, then throw a {{TypeError}}.
136144
1. If |buffer| is empty, return.
137145
1. Split |buffer| into one or more non-empty pieces and convert them into {{Uint8Array}}s.
138146
1. For each {{Uint8Array}} |array|, [=TransformStream/enqueue=] |array| in |ds|'s [=GenericTransformStream/transform=].
147+
</div>
139148

140149

141150
# Privacy and security considerations # {#privacy-security}

0 commit comments

Comments
 (0)