Rx.Observable.prototype.startWith([scheduler] ...args)

Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.

Arguments

  1. [scheduler] (Scheduler): Scheduler to execute the function.
  2. args (arguments): Values to prepend to the observable sequence.

Returns

(Observable): The source sequence prepended with the specified values.

Example

var source = Rx.Observable.return(4)
    .startWith(1, 2, 3)

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

// => Next: 1
// => Next: 2
// => Next: 3
// => Next: 4
// => Completed

Location

File:

Dist:

Prerequisites:

  • None

NPM Packages:

NuGet Packages:

Unit Tests:

results matching ""

    No results matching ""