Beta (still building)

audit

audit operator, you should pass a duration selector to indicate audit period, and it will return most recently emitted value

duration selector can be finished observable, or simple observable

Example: audit operator normal use

With a finished (completed) duration observable

import { interval, empty } from 'rxjs';
import { audit, delay, take } from 'rxjs/operators'

const interval$ = interval(1000).pipe(take(10));
const duration$ = empty().pipe(delay(2000)); // duration selector --|->

const audit$ = interval$.pipe(audit((e) => duration$));

Example: with mouse click to indicate duration

import { interval, empty, fromEvent } from 'rxjs';
import { audit, delay, take } from 'rxjs/operators'

const interval$ = interval(1000);
const duration$ = fromEvent(document, 'click'); // duration selector --|->

const audit$ = interval$.pipe(audit((e) => duration$));

Example: with Promise

When use promise as duration indicator, the behaviour is like ignore during x time

import { interval, empty, fromEvent } from 'rxjs';
import { audit, delay, take } from 'rxjs/operators'

const interval$ = interval(1000).pipe(take(10));
const duration = new Promise((resolve) => {setTimeout(resolve, 4000)});

const audit$ = interval$.pipe(audit((e) => duration));

Official Doc: rxjs.audit