Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 2.27 KB

when.md

File metadata and controls

58 lines (45 loc) · 2.27 KB

Rx.Observable.when(...args)

A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.

Arguments

  1. args (arguments|Array): A series of plans (specified as an Array of as a series of arguments) created by use of the then operator on patterns.

Returns

(Observable): Observable sequence with the results form matching several patterns.

Example

// Fire each plan when both are ready
var source = Rx.Observable.when(
  Rx.Observable.timer(100).and(Rx.Observable.timer(500)).thenDo(function (x, y) { return 'first'; }),
  Rx.Observable.timer(400).and(Rx.Observable.timer(300)).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: second
// => Next: first
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: