-
Notifications
You must be signed in to change notification settings - Fork 8
richardszalay edited this page May 20, 2011
·
4 revisions
Maps values from a source sequence through a function and emits the returned values.
function map(valueClass : Class, selector : Function) : IObservable.<TResult>
Where valueClass is the output type of selector
Where selector is: function (value : sourceType) : TResult
The returned sequence completes when the source sequence completes.
The returned sequence raises an error if the source sequence raises an error.
s = selector
xs ──o────o────o───/
│ │ │ │
s(x) s(x) s(x) │
│ │ │ │
ys ──o────o────o───/
IObservable.<TResult>
Observable.range(0, 5)
.map(function(v:int) : String { return v.toString() + "!"; })
.subscribe(
function(value : String) : void { trace(value); },
function():void { trace("Completed"); }
);
// Trace output is:
// 0!
// 1!
// 2!
// 3!
// 4!
// Completed