Table of Contents

Class TakeUntilOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Extension methods implementing the takeUntil operator.

public static class TakeUntilOperator
Inheritance
System.Object
TakeUntilOperator

Methods

TakeUntil<T, TNotifier>(Observable<T>, Observable<TNotifier>)

Mirrors source until notifier emits its first value, at which point the output completes and both source and notifier are unsubscribed. If notifier never emits, all of source's values are passed through.

public static Observable<T> TakeUntil<T, TNotifier>(this Observable<T> source, Observable<TNotifier> notifier)

Parameters

source Observable<T>

The source sequence to mirror.

notifier Observable<TNotifier>

The observable whose first emitted value causes the output to complete.

Returns

Observable<T>

An observable that emits the values of source until notifier emits.

Type Parameters

T

The type of values emitted by source and by the output.

TNotifier

The type of values emitted by notifier. Irrelevant to the output — only the fact that a value was emitted matters, not its contents.

Remarks

Only notifier's first next notification matters: if it errors or completes without ever emitting a value, that is ignored and has no effect on the output — it does not complete or error the output, matching rxjs's own takeUntil behavior (which passes an explicit no-op error handler to the notifier subscription for exactly this reason — see takeUntil.ts's own createOperatorSubscriber(subscriber, () => subscriber.complete(), noop)). The notifier subscription here does the same: an explicit no-op onError, not an omitted one — omitting it entirely would leave a notifier error unhandled (forwarded to OnUnhandledError) rather than genuinely ignored.