Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 2.16 KB

and.md

File metadata and controls

57 lines (44 loc) · 2.16 KB

Rx.Observable.prototype.and(rightSource)

Propagates the observable sequence that reacts first.

Arguments

  1. right (Observable): Observable sequence to match with the current sequence.

Returns

(Pattern): Pattern object that matches when both observable sequences have an available value.

Example

// Choice of either plan, the first set of timers or second set
var source = Rx.Observable.when(
    Rx.Observable.timer(200).and(Rx.Observable.timer(300)).thenDo(function (x, y) { return 'first'; }),
    Rx.Observable.timer(400).and(Rx.Observable.timer(500)).thenDo(function (x, y) { return 'second'; }),
);

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

// => Next: first
// => Next: second
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: