Skip to main content

takeUntilObservablePipe

Alternative: takeUntil$$$

Inlined: takeUntilObservable, takeUntil$$

Types

function takeUntilObservablePipe<GValue>(
until: IObservable<any>,
): IObservablePipe<GValue, GValue>

Definition

This pipe emits the values emitted by the source Observable until an Observable (until) emits a value.

The RxJS equivalent is takeUntil.

Diagram

Example

Display values until a 4500ms timeout is reached

const until$ = timeout(4500);

const subscribe = pipe$$(interval(1000), [
scan$$$<void, number>(count => (count + 1), 0),
takeUntil$$$<number>(until$),
]);

subscribe((value: number) => {
console.log(value);
});

Output:

// t = 1000ms
1
// t = 2000ms
2
// t = 3000ms
3
// t = 4000ms
4
// t = 4500ms => unsubscribe