{% if book.isPdf==true %}
{% else %}
{% endif %}
Propagates the observable sequence or Promise that reacts first. "amb" stands for ambiguous.
args
(Array|arguments): Observable sources or Promises competing to react first either as an array or arguments.
(Observable
): An observable sequence that surfaces any of the given sequences, whichever reacted first.
{% if book.isPdf==true %}
var source = Rx.Observable.amb(
Rx.Observable.timer(500).select(() => 'foo'),
Rx.Observable.timer(200).select(() => 'bar')
);
var subscription = source.subscribe(
x => console.log(`onNext: ${x}`),
e => console.log(`onError: ${e}`),
() => console.log('onCompleted'));
// => onNext: bar
// => onCompleted
var source = Rx.Observable.amb(
RSVP.Promise.resolve('foo'),
Rx.Observable.timer(200).select(() => 'bar')
);
var subscription = source.subscribe(
x => console.log(`onNext: ${x}`),
e => console.log(`onError: ${e}`),
() => console.log('onCompleted'));
// => onNext: foo
// => onCompleted
{% else %}
{% endif %}