Demo:  mergeScan

mergeScan is similar to scan , except that the accumulator function returns an observable. So, we should account for any delay in the calculation of accumulated values for each input.

mergeScan( accumulationFunction, seedValue);
let input = of(5, 15, 25, 40, 20)
        .pipe(concatMap(v => of(v).pipe(delay(1500))));

//accumulate and emit after the mapped stream completes
let process = mergeScan((acc,input) =>
               of(acc+input).pipe(delay(2000)), 500);

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