UNPKG

1.33 kBTypeScriptView Raw
1import { Operator, Stream } from '../index';
2export declare class FlattenConcOperator<T> implements Operator<Stream<T>, T> {
3 ins: Stream<Stream<T>>;
4 type: string;
5 private active;
6 out: Stream<T>;
7 constructor(ins: Stream<Stream<T>>);
8 _start(out: Stream<T>): void;
9 _stop(): void;
10 less(): void;
11 _n(s: Stream<T>): void;
12 _e(err: any): void;
13 _c(): void;
14}
15/**
16 * Flattens a "stream of streams", handling multiple concurrent nested streams
17 * simultaneously.
18 *
19 * If the input stream is a stream that emits streams, then this operator will
20 * return an output stream which is a flat stream: emits regular events. The
21 * flattening happens concurrently. It works like this: when the input stream
22 * emits a nested stream, *flattenConcurrently* will start imitating that
23 * nested one. When the next nested stream is emitted on the input stream,
24 * *flattenConcurrently* will also imitate that new one, but will continue to
25 * imitate the previous nested streams as well.
26 *
27 * Marble diagram:
28 *
29 * ```text
30 * --+--------+---------------
31 * \ \
32 * \ ----1----2---3--
33 * --a--b----c----d--------
34 * flattenConcurrently
35 * -----a--b----c-1--d-2---3--
36 * ```
37 *
38 * @return {Stream}
39 */
40export default function flattenConcurrently<T>(ins: Stream<Stream<T>>): Stream<T>;