Table of Contents

Class RepeatWhenOperator

Namespace
RxSharp.Operators
Assembly
RxSharp.dll

Extension methods implementing the repeatWhen operator.

public static class RepeatWhenOperator
Inheritance
System.Object
RepeatWhenOperator

Remarks

The Repeat<T>(Observable<T>, int, TimeSpan?, IScheduler?) counterpart to RetryWhen<T, TNotification>(Observable<T>, Func<Observable<Exception>, Observable<TNotification>>): instead of a repeat budget, notifier receives an observable of a notification for every completion source raises and returns an observable whose emissions each trigger a resubscription. If the notifier observable completes, the whole sequence completes; if it errors, that error becomes the final error forwarded downstream. Unlike RetryWhen<T, TNotification>(Observable<T>, Func<Observable<Exception>, Observable<TNotification>>), source errors are never intercepted here — they are forwarded via OnError immediately, matching Repeat<T>(Observable<T>, int, TimeSpan?, IScheduler?)'s own "retry is for errors, repeat is for completions" split.

Methods

RepeatWhen<T, TNotification>(Observable<T>, Func<Observable<Unit>, Observable<TNotification>>)

Resubscribes to source whenever it completes, but only once the observable returned by notifier (given an observable of one notification per completion so far) emits a value in response to that completion. If the notifier observable completes instead of emitting, the sequence completes. If it errors, that error is forwarded downstream via OnError.

public static Observable<T> RepeatWhen<T, TNotification>(this Observable<T> source, Func<Observable<Unit>, Observable<TNotification>> notifier)

Parameters

source Observable<T>

The source sequence to repeat on completion.

notifier Func<Observable<Unit>, Observable<TNotification>>

A function, called with an observable of one notification per completion source has raised so far, that returns an observable whose emissions each trigger a resubscription to source.

Returns

Observable<T>

An observable that mirrors source, resubscribing on completion as directed by notifier.

Type Parameters

T

The type of values emitted by source.

TNotification

The element type of the observable returned by notifier; only its emissions/termination matter, not the values themselves.

Remarks

notifier is called once per subscription, lazily, the first time source completes — not eagerly at subscribe time. If notifier itself throws, that exception is forwarded via OnError. The value type of the notifier's output observable is never inspected — only whether and when it emits, errors, or completes. Rxjs passes Observable<void> for the notification channel; this port uses Unit in its place (see CLAUDE.md's Core design).