debounceTime
operator ignores emitted values when the time between them is less than indicated
and takes the last emits value in this period.
If emits value is pair will delay 2 seconds, otherwise, it will delay 1 second
import { from, of } from 'rxjs';
import { debounceTime, concatMap, delay } from 'rxjs/operators';
const source$ = from([0, 1, 2, 3, 4, 5, 6]).pipe(
concatMap( i => of(i).pipe(delay( (i%2 + 1) * 1000)))
);
const result$ = source$.pipe(debounceTime(1500));
click the page to generate events
import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
const source$ = fromEvent(document, 'click');
const result$ = source$.pipe(debounceTime(500));
Official Doc: rxjs.debounceTime