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 var maxDelayMSecs:int = 15000
public var probabilityOfFault:Number = 0.0
public var token:Object
public function AsyncStubProxy(name:String = null)Parameters
| name:String (default = null) |
public function asyncAction(resultFunction:Function, faultFunction:Function = null):voidParameters
| resultFunction:Function |
| |
| faultFunction:Function (default = null) |
protected function calcCompletionFunction():Function
Returns
protected function onFault(event:Event):voidParameters
protected function onResult(event:Event):voidParameters
protected const ONE_ONLY_MSG:String = "AsyncStubProxy: Cannot have more than one async activity running per stub"