@@ -155,98 +155,3 @@ Available TransformStream classes include:
155155- All timing operators : ` DelayTransform ` , ` DebounceTimeTransform ` , ` ThrottleTimeTransform ` , etc .
156156- All flattening operators : ` MergeMapTransform ` , ` SwitchMapTransform ` , ` ConcatMapTransform ` , etc .
157157- All utility operators : ` TapTransform ` , ` CatchErrorTransform ` , ` TakeTransform ` , etc .
158-
159- ## Type Utilities
160-
161- ### ` isReadableStream() `
162-
163- Type guard to check if an object is a ` ReadableStream ` .
164-
165- ` ` ` typescript
166- import { isReadableStream } from 'web-streams-extensions';
167-
168- if (isReadableStream(obj)) {
169- // obj is guaranteed to be ReadableStream
170- const reader = obj.getReader();
171- }
172- ` ` `
173-
174- ### ` isTransform() `
175-
176- Type guard to check if an operator is a ` TransformStream ` .
177-
178- ` ` ` typescript
179- import { isTransform } from 'web-streams-extensions';
180-
181- if (isTransform(op)) {
182- // op is a TransformStream, can use with pipeThrough
183- stream.pipeThrough(op);
184- } else {
185- // op is a function, use with pipe
186- stream.pipe(op);
187- }
188- ` ` `
189-
190- ## Async Utilities
191-
192- ### ` sleep() `
193-
194- Returns a Promise that resolves after a specified duration .
195-
196- ` ` ` typescript
197- import { sleep } from 'web-streams-extensions';
198-
199- // Wait for 1 second
200- await sleep(1000);
201- ` ` `
202-
203- ### ` Signal `
204-
205- A simple event signaling mechanism for coordination between async operations .
206-
207- ` ` ` typescript
208- import { Signal } from 'web-streams-extensions';
209-
210- const signal = new Signal();
211-
212- // Wait for signal
213- await signal.wait();
214-
215- // Trigger the signal from elsewhere
216- signal.fire();
217- ` ` `
218-
219- ### ` Gate `
220-
221- A reusable async gate that can be opened and closed multiple times .
222-
223- ` ` ` typescript
224- import { Gate } from 'web-streams-extensions';
225-
226- const gate = new Gate();
227-
228- // Close the gate
229- gate.close();
230-
231- // Wait for gate to open
232- await gate.wait();
233-
234- // Open the gate
235- gate.open();
236- ` ` `
237-
238- ### ` BlockingQueue<T> `
239-
240- An async queue that blocks when empty .
241-
242- ` ` ` typescript
243- import { BlockingQueue } from 'web-streams-extensions';
244-
245- const queue = new BlockingQueue<number>();
246-
247- // This will block until something is added
248- const item = await queue.dequeue();
249-
250- // Add items from another context
251- queue.enqueue(42);
252- ` ` `
0 commit comments