Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (23 sloc) 652 Bytes

Combines all stream values into one array, emits this array and immediately completes

const { rxObserver } = require('api/v0.3');
const { timer } = require('rxjs');
const { take, toArray } = require('rxjs/operators');


// create a timer with 3 events
const source$ = timer(0, 5).pipe(
    take(3)
  );

// collapse all events into one array
const result$ = source$.pipe(
    toArray()
  );

source$.subscribe(rxObserver('timer(0, 10).take(4)'));
result$.subscribe(rxObserver('.toArray()'));
You can’t perform that action at this time.