Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
60 lines (47 loc) · 2.42 KB

expand.md

File metadata and controls

60 lines (47 loc) · 2.42 KB

Rx.Observable.prototype.expand(selector, [scheduler])

Expands an observable sequence by recursively invoking selector.

Arguments

  1. selector (Function): Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
  2. [scheduler=Rx.Scheduler.immediate] (Scheduler): Scheduler on which to perform the expansion. If not provided, this defaults to the immediate scheduler.

Returns

(Observable): An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.

Example

var source = Rx.Observable.return(42)
    .expand(function (x) { return Rx.Observable.return(42 + x); })
    .take(5);

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

// => Next: 42
// => Next: 84
// => Next: 126
// => Next: 168
// => Next: 210
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: