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

Latest commit

 

History

History
62 lines (48 loc) · 2.29 KB

thendo.md

File metadata and controls

62 lines (48 loc) · 2.29 KB

Rx.Observable.prototype.thenDo(selector)

Matches when the observable sequence has an available value and projects the value.

Arguments

  1. selector (Function): Selector that will be invoked for values in the source sequence.

Returns

(Plan): Plan that produces the projected values, to be fed (with other plans) to the when operator.

Example

var selector = function (x, y) { return x + ", " + y; };

var source = Rx.Observable.when(
    Rx.Observable.interval(250).and(Rx.Observable.of("A", "B", "C")).thenDo(selector),
    Rx.Observable.interval(300).and(Rx.Observable.of("a", "b")).thenDo(selector)
);

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

// => Next: 0, A 
// => Next: 0, a
// => Next: 1, B
// => Next: 1, b
// => Next: 2, C
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: