Rx.Observable.prototype.doWhile(condition)

Repeats source as long as condition holds emulating a do while loop.

Arguments

  1. condition (Function): The condition which determines if the source will be repeated.

Returns

(Observable): An observable sequence whose observers trigger an invocation of the given observable factory function.

Example

var i = 0;

var source = Rx.Observable.return(42).doWhile(function (x) { return ++i < 2; });

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: 42
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests:

results matching ""

    No results matching ""