Skip to content

distinctUntilChanged()

Function

distinctUntilChanged<T>(comparator?: Function): ContinuingPipeOperator<T, T>

Prevents emission of a value in the observable chain, if the value did not change.

ts
declare const read1: Read<string>;
const read: Read<string> = read1.pipe(distinctUntilChanged<string>());

Observable Behavior:

Works exactly like distinctUntilChanged of RxJS.

Sync Behavior:

Has no effect on sync calls. The value is just passed through.

Source: rxjs-read/src/lib/operators/distinct-until-changed.operator.ts:27

Type parameters

ParameterDescription
Ttype of the value

Parameters

ParameterTypeDescription
comparator?(previous: T, current: T) => booleanoptionally pass a comparator function to use.

Returns

ContinuingPipeOperator<T, T>