Demo:  switchScan

Like switchMap, switchScan ignores any incomplete accumulation observable and starts the accumulationFunction immediately for a new value as it arrives from the source.

switchScan( accumulationFunction, seedValue);
//Gap between each input is 1.5 sec
let input = of(5, 15, 25, 40, 20)
        .pipe(concatMap(v => of(v).pipe(delay(1500))));

//it will cancel any accumulation taking more than 1.5 sec
let process = switchScan((acc,input) =>
              of(acc+input).pipe(delay(Math.random()*3000)),
              500);

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