Packageorg.puremvc.as3.utilities.asyncstub.model
Classpublic class AsyncStubProxy
InheritanceAsyncStubProxy Inheritance org.puremvc.as3.patterns.proxy.Proxy
Implementsorg.puremvc.as3.interfaces.IProxy

Can be used to simulate an asynchrounous activity. Instantiate as a proxy, with or without a name. The async activity is started by invoking the asyncAction method. There cannot be more than one activity running per stub instance.

Uses a random number for the async delay. Set the max delay in msecs using the maxDelayMSecs property.

When the async action completes, it invokes either a result method or a fault method, similar to IResponder. Use the probabilityOfFault property to govern random selection of the method.

Includes the facility to set a token property that will be returned to the result/fault method, enabling the client app to track the stub instance that invoked the result/fault. This facility is optional. If the token is not set, no arguments are passed to the result/fault method.

See the demo StartupAsOrdered for an example of use.



Public Properties
 PropertyDefined by
  maxDelayMSecs : int = 15000
AsyncStubProxy
  probabilityOfFault : Number = 0.0
AsyncStubProxy
  token : Object
AsyncStubProxy
Public Methods
 MethodDefined by
  
AsyncStubProxy(name:String = null)
AsyncStubProxy
  
asyncAction(resultFunction:Function, faultFunction:Function = null):void
AsyncStubProxy
Protected Methods
 MethodDefined by
  
AsyncStubProxy
  
onFault(event:Event):void
AsyncStubProxy
  
onResult(event:Event):void
AsyncStubProxy
Protected Constants
 ConstantDefined by
  ONE_ONLY_MSG : String = "AsyncStubProxy: Cannot have more than one async activity running per stub"
AsyncStubProxy
Property detail
maxDelayMSecsproperty
public var maxDelayMSecs:int = 15000
probabilityOfFaultproperty 
public var probabilityOfFault:Number = 0.0
tokenproperty 
public var token:Object
Constructor detail
AsyncStubProxy()constructor
public function AsyncStubProxy(name:String = null)Parameters
name:String (default = null)
Method detail
asyncAction()method
public function asyncAction(resultFunction:Function, faultFunction:Function = null):voidParameters
resultFunction:Function
 
faultFunction:Function (default = null)
calcCompletionFunction()method 
protected function calcCompletionFunction():Function

Returns
Function
onFault()method 
protected function onFault(event:Event):voidParameters
event:Event
onResult()method 
protected function onResult(event:Event):voidParameters
event:Event
Constant detail
ONE_ONLY_MSGconstant
protected const ONE_ONLY_MSG:String = "AsyncStubProxy: Cannot have more than one async activity running per stub"