Class TakeUntilOperator
Extension methods implementing the takeUntil operator.
public static class TakeUntilOperator
- Inheritance
-
System.ObjectTakeUntilOperator
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
sourceObservable<T>The source sequence to mirror.
notifierObservable<TNotifier>The observable whose first emitted value causes the output to complete.
Returns
- Observable<T>
An observable that emits the values of
sourceuntilnotifieremits.
Type Parameters
TThe type of values emitted by
sourceand by the output.TNotifierThe 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.