UNPKG

1.38 kBTypeScriptView Raw
1import "./sample";
2import Observable, { EventStream } from "./observable";
3/**
4 Zips the array of EventStreams / Properties in to a new
5 EventStream that will have an array of values from each source as
6 its value. Zipping means that events from each source are combined
7 pairwise so that the 1st event from each source is published first, then
8 the 2nd event from each. The results will be published as soon as there
9 is a value from each source.
10
11 Be careful not to have too much "drift" between streams. If one stream
12 produces many more values than some other excessive buffering will
13 occur inside the zipped observable.
14
15 Example:
16
17 ```js
18 x = Bacon.fromArray([1,2,3])
19 y = Bacon.fromArray([10, 20, 30])
20 z = Bacon.fromArray([100, 200, 300])
21 Bacon.zipAsArray(x, y, z)
22
23 # produces values [1, 10, 100], [2, 20, 200] and [3, 30, 300]
24 ```
25
26 */
27export declare function zipAsArray<V>(...args: (Observable<V> | Observable<V>[])[]): Observable<V[]>;
28/**
29 Like [`zipAsArray`](#bacon-zipasarray) but uses the given n-ary
30 function to combine the n values from n sources, instead of returning them in an Array.
31 */
32export declare function zipWith<Out>(f: (...any: any[]) => Out, ...streams: Observable<any>[]): EventStream<Out>;
33/** @hidden */
34export declare function zip<V, V2, Out>(left: Observable<V>, right: Observable<V2>, f: (left: V, right: V2) => Out): EventStream<Out>;