Back to Rxjs

This is RxJS v 4. Find the latest version here

doc/api/core/operators/dowhile.md

4.1.02.1 KB
Original Source

This is RxJS v 4. Find the latest version here

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

js
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: