Star

Created With


merge



Merges data from multiple callbag sources:

1linkfunction merge<T>(...sources: Source<T>[]): Source<T>

1linkimport { interval, pipe, subscribe, merge, map } from 'callbag-common';

2link

3linkpipe(

4link merge(

5link pipe(interval(500), map(a => 'A = ' + a)),

6link pipe(interval(1000), map(b => 'B = ' + b)),

7link ),

8link subscribe(console.log)

9link)

A = 0 B = 0 A = 1 A = 2 B = 1 A = 3 A = 4 B = 2 ...
► Try It!

👉 Basically whenever any of the sources emits, the merged source will also emit the same data.




Home What Are Callbags?

Source Factorieschevron_right
Operatorschevron_right
Combinationchevron_right
Utilitieschevron_right