Hullo JS
Search…
combineLatest
import { combineLatest } from '@hullo/core';
This is a function that should be provided with an array of observables and will return new observable that sends out arrays of last values emitted through these source observables.
1
import { of, map, combineLatest } from '@hullo/core';
2
​
3
const og = of([1,2,3]);
4
​
5
combineLatest([
6
og.pipe(map(n => n * 1)),
7
og.pipe(map(n => n * 2)),
8
og.pipe(map(n => n * 3)),
9
]).subscribe({
10
next: console.log
11
});
12
// as og emits 1
13
// prints: [ 1, 2, 3 ]
14
​
15
// as og emits 3
16
// prints: [ 3, 6, 9 ]
17
​
18
// as og emits 5
19
// prints: [ 5, 10, 15 ]
Copied!
Last modified 2yr ago
Copy link