Demo:  bufferWhen

bufferWhen operator keeps collecting the incoming data into a new array and emits as the specified internal observable emits.

//Emit 7 items every 1.5 sec, starting immediately
let input = timer(0,1500).pipe(take(7));

//buffer and emit when the internal observable emits
let process = bufferWhen(() =>
              interval(500 + Math.random() * 2000));

let output=input.pipe(process).subscribe(v=>console.log(v))