Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 2.12 KB

fromarray.md

File metadata and controls

61 lines (47 loc) · 2.12 KB

** DEPRECATED - Use Rx.Observable.from instead** Rx.Observable.fromArray(array, [scheduler])

Converts an array to an observable sequence, using an optional scheduler to enumerate the array.

Arguments

  1. array (Array): An array to convert to an Observable sequence.
  2. [scheduler=Rx.Scheduler.currentThread] (Scheduler): Scheduler to run the enumeration of the input sequence on.

Returns

(Observable): The observable sequence whose elements are pulled from the given enumerable sequence.

Example

var array = [1,2,3];

var source = Rx.Observable.fromArray(array);

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

Location

File:

Dist:

Prerequisites:

  • None

NPM Packages:

NuGet Packages:

Unit Tests: