Packageraix.reactive
Classpublic class Observable
InheritanceObservable Inheritance Object

Provides static methods that create IObservable sequences



Public Properties
 PropertyDefined By
  maxConcurrentLoaders : uint
[static] Gets the maximum number of urlLoaders that can execute concurrently.
Observable
Public Methods
 MethodDefined By
  
Observable
  
amb(sources:Array):IObservable
[static] Takes multiple source sequences and returns values from the first sequence to emit a value
Observable
  
catchErrors(sources:Array, scheduler:IScheduler = null):IObservable
[static] Concatonates a list of sequences as each one errors.
Observable
  
concat(sources:*):IObservable
[static] Concatonates multiple sequences by running each sequence as the previous one finishes
Observable
  
create(subscribeFunc:Function):IObservable
[static] Creates a custom observable sequence
Observable
  
createWithCancelable(subscribeFunc:Function):IObservable
[static] Creates a custom observable sequence that uses cancelable resources
Observable
  
defer(observableFactory:Function):IObservable
[static] Defers selection of a sequence until the sequence is subscribed to
Observable
  
empty(scheduler:IScheduler = null):IObservable
[static] Creates a sequence that immediately completes
Observable
  
error(err:Error):IObservable
[static] Creates a sequence that immediately throws an Error
Observable
  
forkJoin(sources:Array):IObservable
[static] Subscribes to multiple source sequence and emits the last values of each after all have completed
Observable
  
fromArray(values:Array, scheduler:IScheduler = null):IObservable
[static] Creates a sequence consisting of the values in an Array
Observable
  
fromErrorEvent(eventDispatcher:IEventDispatcher, eventType:String, useCapture:Boolean = false, priority:int = 0, errorMap:Function = null):IObservable
[static] Creates a sequence that emits an error when an event is received from an IEventDispatcher
Observable
  
fromErrorEvents(eventDispatcher:IEventDispatcher, eventTypes:Array, useCapture:Boolean = false, priority:int = 0, errorMap:Function = null):IObservable
[static] Creates a sequence that emits an error when one of several event valueClasss is received from an IEventDispatcher
Observable
  
fromEvent(eventDispatcher:IEventDispatcher, eventType:String, useCapture:Boolean = false, priority:int = 0):IObservable
[static] Creates a sequence of events from an IEventDispatcher
Observable
  
fromEvents(eventDispatcher:IEventDispatcher, eventTypes:Array, useCapture:Boolean = false, priority:int = 0):IObservable
[static] Creates Combines events from multiple event valueClasss
Observable
  
generate(initialState:Object, predicate:Function, iterate:Function, resultMap:Function, scheduler:IScheduler = null):IObservable
[static] Creates a custom observable sequence that is controlled by methods supplied as arguments
Observable
  
ifElse(predicate:Function, ifTrue:IObservable, ifFalse:IObservable):IObservable
[static] Defers selection of one of two sequences until the sequence is subscribed to
Observable
  
interval(intervalMs:uint, scheduler:IScheduler = null):IObservable
[static] Creates an unending observable sequence of integers that are incremented at a regular interval
Observable
  
lookup(keySelector:Function, dictionary:Dictionary):IObservable
[static] Defers selection of the sequence to use by using a function that returns a key into a dictionary of sequences
Observable
  
merge(sources:*, concurrent:uint = 0):IObservable
[static] Emits the values from multiple sources in the order that they arrive
Observable
  
[static] Returns an IObservable that never completes
Observable
  
onErrorResumeNext(sources:Array, scheduler:IScheduler = null):IObservable
[static] Concatonates a list of sequence as each one errors or complete
Observable
  
range(start:int, count:uint, scheduler:IScheduler = null):IObservable
[static] Creates a sequence of consecutive integers
Observable
  
repeatValue(val:Object, repeatCount:uint = 0, scheduler:IScheduler = null):IObservable
[static] Repeats a value a specification number of times
Observable
  
start(action:Function, scheduler:IScheduler = null):IObservable
[static] Creates a sequence based on a call to a function
Observable
  
timer(delayMs:uint, intervalMs:uint, scheduler:IScheduler = null):IObservable
[static] Creates an unending observable sequence of integers that begin after a delay and are incremented at a regular interval
Observable
  
toAsync(action:Function, scheduler:IScheduler = null):Function
[static] Converts a function into an observable sequence
Observable
  
uncaughtErrors(loaderInfo:LoaderInfo = null):IObservable
[static]
Observable
  
urlLoader(request:URLRequest, dataFormat:String = text, loaderContext:LoaderContext = null):IObservable
[static] Creates an observable sequence that loads an object from a URLRequest
Observable
  
value(val:Object, scheduler:IScheduler = null):IObservable
[static] Create a sequence consisting of exactly one value
Observable
  
when(plans:Array):IObservable
[static] Matches multiple plans (source sequence combinations) in the order they are specified
Observable
  
xml(request:URLRequest, loaderContext:LoaderContext = null):IObservable
[static] Loads an XML document
Observable
Property Detail
maxConcurrentLoadersproperty
maxConcurrentLoaders:uint

Gets the maximum number of urlLoaders that can execute concurrently. The value defaults to 2 to prevent issues in some browers.


Implementation
    public static function get maxConcurrentLoaders():uint
    public static function set maxConcurrentLoaders(value:uint):void
Constructor Detail
Observable()Constructor
public function Observable()



Method Detail
amb()method
public static function amb(sources:Array):IObservable

Takes multiple source sequences and returns values from the first sequence to emit a value

Parameters

sources:Array — The sources that will be subscribed to

Returns
IObservable — An observable sequence of the same valueClass as the first sequence in sources
catchErrors()method 
public static function catchErrors(sources:Array, scheduler:IScheduler = null):IObservable

Concatonates a list of sequences as each one errors. A successful sequence ends the concatonation.

Parameters

sources:Array — The list of sequence to concatonate.
 
scheduler:IScheduler (default = null) — The scheduler used to control flow

Returns
IObservable — An observable sequence with the valueClass of the first sequence in sources
concat()method 
public static function concat(sources:*):IObservable

Concatonates multiple sequences by running each sequence as the previous one finishes

Parameters

sources:* — Anything that can be converted to an IObservable of IObservables using toObservable

Returns
IObservable — An observable sequence of valueClass
create()method 
public static function create(subscribeFunc:Function):IObservable

Creates a custom observable sequence

Parameters

subscribeFunc:Function — The function that will be executed when a subscriber subscribes, the return value of which is a function to be run when the sequence is terminated

Returns
IObservable — An observable sequence of valueClass
createWithCancelable()method 
public static function createWithCancelable(subscribeFunc:Function):IObservable

Creates a custom observable sequence that uses cancelable resources

Parameters

subscribeFunc:Function — The function that will be executed when a subscriber subscribes, the return value of which is an ICancelable to be canceled when the sequence is terminated

Returns
IObservable — An observable sequence of valueClass
defer()method 
public static function defer(observableFactory:Function):IObservable

Defers selection of a sequence until the sequence is subscribed to

Parameters

observableFactory:Function — The function that will be executed when a new subscription occurs, the returned sequence will be used for the subscriber.

Returns
IObservable — An observable sequence of valueClass
empty()method 
public static function empty(scheduler:IScheduler = null):IObservable

Creates a sequence that immediately completes

Parameters

scheduler:IScheduler (default = null) — The scheduler to use

Returns
IObservable — An observable sequence of valueClass
error()method 
public static function error(err:Error):IObservable

Creates a sequence that immediately throws an Error

Parameters

err:Error — The error to raise when a new subscription occurs

Returns
IObservable — An observable sequence of valueClass
forkJoin()method 
public static function forkJoin(sources:Array):IObservable

Subscribes to multiple source sequence and emits the last values of each after all have completed

Parameters

sources:Array — The sequences to subscribe to

Returns
IObservable — An observable sequence of Array
fromArray()method 
public static function fromArray(values:Array, scheduler:IScheduler = null):IObservable

Creates a sequence consisting of the values in an Array

Parameters

values:Array — The array of values to iterate through
 
scheduler:IScheduler (default = null) — The scheduler used to control flow

Returns
IObservable — An observable sequence of elementClass
fromErrorEvent()method 
public static function fromErrorEvent(eventDispatcher:IEventDispatcher, eventType:String, useCapture:Boolean = false, priority:int = 0, errorMap:Function = null):IObservable

Creates a sequence that emits an error when an event is received from an IEventDispatcher

Parameters

eventDispatcher:IEventDispatcher — The IEventDispatcher that dispatches the event
 
eventType:String — The event type
 
useCapture:Boolean (default = false) — Whether to pass useCapture when subscribing to and unsubscribing from the event
 
priority:int (default = 0) — The priority of the event
 
errorMap:Function (default = null) — The function that maps an event to an Error. null can be used if the event will be ErrorEvent

Returns
IObservable — An observable sequence of valueClass, or Object if valueClass is null
fromErrorEvents()method 
public static function fromErrorEvents(eventDispatcher:IEventDispatcher, eventTypes:Array, useCapture:Boolean = false, priority:int = 0, errorMap:Function = null):IObservable

Creates a sequence that emits an error when one of several event valueClasss is received from an IEventDispatcher

Parameters

eventDispatcher:IEventDispatcher — The IEventDispatcher that dispatches the event
 
eventTypes:Array — The event types that signify an error
 
useCapture:Boolean (default = false) — Whether to pass useCapture when subscribing to and unsubscribing from the event
 
priority:int (default = 0) — The priority of the event
 
errorMap:Function (default = null) — The function that maps an event to an Error. null can be used if the event will be ErrorEvent

Returns
IObservable — An observable sequence of
fromEvent()method 
public static function fromEvent(eventDispatcher:IEventDispatcher, eventType:String, useCapture:Boolean = false, priority:int = 0):IObservable

Creates a sequence of events from an IEventDispatcher

Parameters

eventDispatcher:IEventDispatcher — The IEventDispatcher that dispatches the event
 
eventType:String — The valueClass of event dispatched by eventDispatcher. Event will be used if this argument is null.
 
useCapture:Boolean (default = false) — Whether to pass useCapture when subscribing to and unsubscribing from the event
 
priority:int (default = 0) — The priority of the event

Returns
IObservable — An observable sequence of eventType, or Event if eventType is null
fromEvents()method 
public static function fromEvents(eventDispatcher:IEventDispatcher, eventTypes:Array, useCapture:Boolean = false, priority:int = 0):IObservable

Creates Combines events from multiple event valueClasss

Parameters

eventDispatcher:IEventDispatcher — The IEventDispatcher that dispatches the event
 
eventTypes:Array — An array event type names
 
useCapture:Boolean (default = false) — Whether to pass useCapture when subscribing to and unsubscribing from the event
 
priority:int (default = 0) — The priority of the event

Returns
IObservable — An observable sequence of commonValueClass, or Event if commonValueClass is null
generate()method 
public static function generate(initialState:Object, predicate:Function, iterate:Function, resultMap:Function, scheduler:IScheduler = null):IObservable

Creates a custom observable sequence that is controlled by methods supplied as arguments

Parameters

initialState:Object — The initial state value to use (of class valueClass)
 
predicate:Function — The predicate to determine whether the sequence has completed
 
iterate:Function — The function executed between iterations
 
resultMap:Function — The function that maps the current state to an output value
 
scheduler:IScheduler (default = null) — The scheduler used to control flow

Returns
IObservable — An observable sequence of valueClass
ifElse()method 
public static function ifElse(predicate:Function, ifTrue:IObservable, ifFalse:IObservable):IObservable

Defers selection of one of two sequences until the sequence is subscribed to

Parameters

predicate:Function — The function to execute when a subscription occurs to determine which sequence to subscribe to
 
ifTrue:IObservable — The sequence to subscribe to if predicate returns true
 
ifFalse:IObservable — The sequence to subscribe to if predicate returns false

Returns
IObservable — An observable sequence of valueClass
interval()method 
public static function interval(intervalMs:uint, scheduler:IScheduler = null):IObservable

Creates an unending observable sequence of integers that are incremented at a regular interval

Parameters

intervalMs:uint — The interval, in milliseconds, to wait in between values
 
scheduler:IScheduler (default = null) — The scheduler used for timing

Returns
IObservable — An observable sequence of int
lookup()method 
public static function lookup(keySelector:Function, dictionary:Dictionary):IObservable

Defers selection of the sequence to use by using a function that returns a key into a dictionary of sequences

Parameters

keySelector:Function — The function that, at the moment of subscription, will return the key into dictionary
 
dictionary:Dictionary — The dictionary of sequences

Returns
IObservable — An observable sequence of valueClass
merge()method 
public static function merge(sources:*, concurrent:uint = 0):IObservable

Emits the values from multiple sources in the order that they arrive

Parameters

sources:* — Either an array of IObservable or an IObservable of IObservables
 
concurrent:uint (default = 0) — The scheduler used to control flow

Returns
IObservable — An observable sequence of valueClass

See also

raix.reactive.toObservable
never()method 
public static function never():IObservable

Returns an IObservable that never completes

Returns
IObservable
onErrorResumeNext()method 
public static function onErrorResumeNext(sources:Array, scheduler:IScheduler = null):IObservable

Concatonates a list of sequence as each one errors or complete

Parameters

sources:Array — The list of sequences to concatonate
 
scheduler:IScheduler (default = null) — The scheduler to use

Returns
IObservable — An observable sequence of the valueClass of the value sequence in sources
range()method 
public static function range(start:int, count:uint, scheduler:IScheduler = null):IObservable

Creates a sequence of consecutive integers

Parameters

start:int — The inclusive start value of the range
 
count:uint — The number of values, including start, to emit
 
scheduler:IScheduler (default = null) — The scheduler to use

Returns
IObservable — An observable sequence of int
repeatValue()method 
public static function repeatValue(val:Object, repeatCount:uint = 0, scheduler:IScheduler = null):IObservable

Repeats a value a specification number of times

Parameters

val:Object — The value to repeat
 
repeatCount:uint (default = 0) — The number of times to emit the value
 
scheduler:IScheduler (default = null) — The scheduler to use

Returns
IObservable — An observable sequence of valueClass
start()method 
public static function start(action:Function, scheduler:IScheduler = null):IObservable

Creates a sequence based on a call to a function

Parameters

action:Function — The function to call
 
scheduler:IScheduler (default = null) — The scheduler to use

Returns
IObservable — An observable sequence of valueClass
timer()method 
public static function timer(delayMs:uint, intervalMs:uint, scheduler:IScheduler = null):IObservable

Creates an unending observable sequence of integers that begin after a delay and are incremented at a regular interval

Parameters

delayMs:uint — The interval, in milliseconds, to wait before the first value
 
intervalMs:uint — The interval, in milliseconds, to wait in between subsequent values
 
scheduler:IScheduler (default = null) — The scheduler used for timing

Returns
IObservable — An observable sequence of int
toAsync()method 
public static function toAsync(action:Function, scheduler:IScheduler = null):Function

Converts a function into an observable sequence

Parameters

action:Function — The function to call
 
scheduler:IScheduler (default = null) — The scheduler to use

Returns
Function — A function accepting the arguments of the original action, but that will return an IObservable when called.
uncaughtErrors()method 
public static function uncaughtErrors(loaderInfo:LoaderInfo = null):IObservable

Parameters

loaderInfo:LoaderInfo (default = null)

Returns
IObservable
urlLoader()method 
public static function urlLoader(request:URLRequest, dataFormat:String = text, loaderContext:LoaderContext = null):IObservable

Creates an observable sequence that loads an object from a URLRequest

Parameters

request:URLRequest — The URLRequest to load
 
dataFormat:String (default = text) — A value of flash.net.URLLoaderDataFormat
 
loaderContext:LoaderContext (default = null) — The optional LoaderContext to use

Returns
IObservable — An observable sequence of Object
value()method 
public static function value(val:Object, scheduler:IScheduler = null):IObservable

Create a sequence consisting of exactly one value

Parameters

val:Object — The value to emit
 
scheduler:IScheduler (default = null) — The scheduler to use to control flow

Returns
IObservable — An observable sequence of valueClass
when()method 
public static function when(plans:Array):IObservable

Matches multiple plans (source sequence combinations) in the order they are specified

Parameters

plans:Array — The array of rx.Plan objects creates using 'and' and 'then'

Returns
IObservable — An observable sequence of valueClass
xml()method 
public static function xml(request:URLRequest, loaderContext:LoaderContext = null):IObservable

Loads an XML document

Parameters

request:URLRequest — The URLRequest to load
 
loaderContext:LoaderContext (default = null) — Whether to ignore whitespace when parsing the XML

Returns
IObservable — An IObservable sequence of XMLDocument