skip to content

buffer

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


const source$ = merge(timer(0, 200), timer(300));

const trigger$ = timer(0, 250);

const buffered$ = source$.pipe(
    buffer(trigger$)
  ); 

source$.subscribe(rxObserver('source$'));
trigger$.subscribe(rxObserver('Buffer trigger$'));
buffered$.subscribe(rxObserver('buffered$'));

⚠️ Execution time is limited to 1000ms
0mssource$start00 11 00 22 33 44 55 Buffer trigger$start00 11 22 33 44 buffered$start[][] [0,1][0,1] [0,2][0,2] [3][3] [4][4]