UNPKG

1.4 kBTypeScriptView Raw
1import { Operator, Stream } from '../index';
2export declare class DropUntilOperator<T> implements Operator<T, T> {
3 o: Stream<any>;
4 ins: Stream<T>;
5 type: string;
6 out: Stream<T>;
7 private oil;
8 private on;
9 constructor(o: Stream<any>, // o = other
10 ins: Stream<T>);
11 _start(out: Stream<T>): void;
12 _stop(): void;
13 up(): void;
14 _n(t: T): void;
15 _e(err: any): void;
16 _c(): void;
17}
18/**
19 * Starts emitting the input stream when another stream emits a next event. The
20 * output stream will emit no items if another stream is empty.
21 *
22 * Marble diagram:
23 *
24 * ```text
25 * ---1---2-----3--4----5----6---
26 * dropUntil( --------a--b--| )
27 * ---------------------5----6|
28 * ```
29 *
30 * Example:
31 *
32 * ```js
33 * import dropUntil from 'xstream/extra/dropUntil'
34 *
35 * const other = xs.periodic(220).take(1)
36 *
37 * const stream = xs.periodic(50)
38 * .take(6)
39 * .compose(dropUntil(other))
40 *
41 * stream.addListener({
42 * next: i => console.log(i),
43 * error: err => console.error(err),
44 * complete: () => console.log('completed')
45 * })
46 * ```
47 *
48 * ```text
49 * > 4
50 * > 5
51 * > completed
52 * ```
53 *
54 * #### Arguments:
55 *
56 * @param {Stream} other Some other stream that is used to know when the output
57 * stream of this operator should start emitting.
58 * @return {Stream}
59 */
60export default function dropUntil<T>(other: Stream<any>): (ins: Stream<T>) => Stream<T>;