Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 2.37 KB

start.md

File metadata and controls

66 lines (52 loc) · 2.37 KB

Rx.Observable.start(func, [scheduler], [context])

Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.

Arguments

  1. func (Function): Function to run asynchronously.
  2. [scheduler=Rx.Scheduler.timeout] (Scheduler): Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
  3. [context] (Any): The context for the func parameter to be executed. If not specified, defaults to undefined.

Returns

(Observable): An observable sequence exposing the function's result value, or an exception.

Example

var context = { value: 42 };

var source = Rx.Observable.start(
    function () {
        return this.value; 
    }, 
    Rx.Scheduler.timeout, 
    context
);

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

// => Next: 42 
// => Completed 

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: