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.2 KB

fromarray.md

File metadata and controls

62 lines (48 loc) · 2.2 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: