Table of Contents

Class AuditOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

The audit/auditTime operators.

public static class AuditOperator
Inheritance
System.Object
AuditOperator

Methods

AuditTime<T>(Observable<T>, TimeSpan, IScheduler?)

Audit<T, TDuration>(Observable<T>, Func<T, Observable<TDuration>>) with a fixed TimeSpan window instead of a per-value duration selector. Built on top of Audit<T, TDuration>(Observable<T>, Func<T, Observable<TDuration>>) using Timer(TimeSpan, IScheduler?) — safe to reuse (unlike Delay, see its own remarks) because Audit only ever has one duration subscription active at a time, so there is no concurrent-timer ordering hazard.

public static Observable<T> AuditTime<T>(this Observable<T> source, TimeSpan duration, IScheduler? scheduler = null)

Parameters

source Observable<T>

The source observable.

duration TimeSpan

The fixed window length.

scheduler IScheduler

The scheduler to time the window with; defaults to TaskPoolScheduler.

Returns

Observable<T>

An observable that emits the most recent value once each window closes.

Type Parameters

T

The element type of the source.

Audit<T, TDuration>(Observable<T>, Func<T, Observable<TDuration>>)

Emits the most recent source value once a "duration" window elapses, ignoring values that arrive while a window is already open (the inverse of debounce, which restarts its timer on every new value instead of ignoring values mid-window). A window opens on the first value seen while idle, via durationSelector(that value); the window closes — and the latest pending value is emitted — as soon as the duration observable emits or completes. Mirrors rxjs's audit.

public static Observable<T> Audit<T, TDuration>(this Observable<T> source, Func<T, Observable<TDuration>> durationSelector)

Parameters

source Observable<T>

The source observable.

durationSelector Func<T, Observable<TDuration>>

Given the value that opened the current window, returns the observable whose first emission or completion closes it.

Returns

Observable<T>

An observable that emits the most recent value once each window closes.

Type Parameters

T

The element type of the source.

TDuration

The (unused) element type of the duration observable.