Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.28 KB

File metadata and controls

52 lines (34 loc) · 1.28 KB

{% if book.isPdf %}

amb

{% else %}

{% endif %}

Propagates the observable sequence or Promise that reacts first. "amb" stands for ambiguous.

Arguments

  1. rightSource (Observable): Second observable sequence.

Returns

(Observable): An observable sequence that surfaces either of the given sequences, whichever reacted first.

{% if book.isPdf %}

var first = Rx.Observable.timer(300).map(function () { return 'first'; });
var second = Rx.Observable.timer(500).map(function () { return 'second'; });

var source = first.amb(second);

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

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

{% else %}

Example

{% endif %}