skip to content

zip

 

Creates Observable from multiple Observables.
Resulting stream will emit a combined value when all input streams emit a new value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const { rxObserver } = require('api/v0.3');
const { zip, timer, from } = require('rxjs');
const { take } = require('rxjs/operators');


const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const alphabet$ = from(alphabet);

zip(
  timer(0, 5),
  alphabet$,
  (digit, letter)=>digit+letter // combinator
)
  .pipe(
    take(10)
  )
  .subscribe(rxObserver());

0msstartcomplete0a0a 1b1b 2c2c 3d3d 4e4e 5f5f 6g6g 7h7h 8i8i 9j9j