-
Notifications
You must be signed in to change notification settings - Fork 8
fromArray
richardszalay edited this page May 20, 2011
·
6 revisions
Creates a sequence of type that emits the values in values then completes. Passing an array to the toObservable global function has a shorthand way of calling this method.
static function fromArray(values : Array.<T>,
scheduler : IScheduler = null) : IObservable.<T>
The returned sequence completes after emitting the last value in values
The returned sequence does not error
────o────────────o────────────────o───────/
values[0] values[1] ... values[n─1]
Unless specified, this operator uses Scheduler.defaultScheduler
.
IObservable.<T>
Observable.fromArray([5, 4, 3, 2, 1])
.subscribe(
function(value:int) : void { trace(value); },
function():void { trace("Completed!"); }
);
// Trace output is:
// 5
// 4
// 3
// 2
// 1
// Completed!