Back to Rxjs

This is RxJS v 4. Find the latest version here

doc/api/core/operators/takeuntil.md

4.1.02.2 KB
Original Source

This is RxJS v 4. Find the latest version here

Rx.Observable.prototype.takeUntil(other)

Returns the values from the source observable sequence until the other observable sequence or Promise produces a value.

Arguments

  1. other (Observable | Promise): Observable sequence or Promise that terminates propagation of elements of the source sequence.

Returns

(Observable): An observable sequence containing the elements of the source sequence up to the point the other sequence or Promise interrupted further propagation.

Example

js
var source = Rx.Observable.timer(0, 1000)
    .takeUntil(Rx.Observable.timer(5000));

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: 0
// => Next: 1
// => Next: 2
// => Next: 3
// => Next: 4
// => Completed

Location

File:

Dist:

Prerequisites:

  • None

NPM Packages:

NuGet Packages:

Unit Tests: