Packageweavejs.core
Classpublic class LinkablePromise
InheritanceLinkablePromise Inheritance Object
Implements ILinkableObject, IDisposableObject

Use this class to build dependency trees involving asynchronous calls. When the callbacks of a LinkablePromise are triggered, a function will be invoked. If the function returns an AsyncToken, LinkablePromise's callbacks will be triggered again when a ResultEvent or FaultEvent is received from the AsyncToken. Dependency trees can be built using newLinkableChild() and registerLinkableChild().

See also

weave.api.core.ISessionManager.newLinkableChild()
weave.api.core.ISessionManager.registerLinkableChild()


Public Properties
 PropertyDefined By
  error : Object
[read-only] The error that occurred calling the invoke function.
LinkablePromise
  result : Object
[read-only] The result of calling the invoke function.
LinkablePromise
Public Methods
 MethodDefined By
  
LinkablePromise(task:Function, description:* = null, validateNow:Boolean = false)
LinkablePromise
  
depend(dependency:ILinkableObject, ... otherDependencies):LinkablePromise
Registers dependencies of the LinkablePromise.
LinkablePromise
  
dispose():void
LinkablePromise
  
fromIterativeTask(initialize:Function, iterativeTask:Function, priority:uint, description:* = null, validateNow:Boolean = false):LinkablePromise
[static] Creates a LinkablePromise from an iterative task function.
LinkablePromise
  
validate():void
If this LinkablePromise is set to lazy mode, this will switch it to non-lazy mode and automatically invoke the async task when necessary.
LinkablePromise
Property Detail
errorproperty
error:Object  [read-only]

The error that occurred calling the invoke function. When this value is accessed, validate() will be called.


Implementation
    public function get error():Object
resultproperty 
result:Object  [read-only]

The result of calling the invoke function. When this value is accessed, validate() will be called.


Implementation
    public function get result():Object
Constructor Detail
LinkablePromise()Constructor
public function LinkablePromise(task:Function, description:* = null, validateNow:Boolean = false)

Parameters
task:Function — A function to invoke, which must take zero parameters and may return an AsyncToken.
 
description:* (default = null) — A description of the task as a String, or a function to call which returns a descriptive string. Such a function has the signature function():String.
 
validateNow:Boolean (default = false)
Method Detail
depend()method
public function depend(dependency:ILinkableObject, ... otherDependencies):LinkablePromise

Registers dependencies of the LinkablePromise.

Parameters

dependency:ILinkableObject
 
... otherDependencies

Returns
LinkablePromise
dispose()method 
public function dispose():void

fromIterativeTask()method 
public static function fromIterativeTask(initialize:Function, iterativeTask:Function, priority:uint, description:* = null, validateNow:Boolean = false):LinkablePromise

Creates a LinkablePromise from an iterative task function.

Parameters

initialize:Function — A function that should be called prior to starting the iterativeTask.
 
iterativeTask:Function — A function which is designed to be called repeatedly across multiple frames until it returns a value of 1.
 
priority:uint — The task priority, which should be one of the static constants in WeaveAPI.
 
description:* (default = null) — A description of the task as a String, or a function to call which returns a descriptive string. Such a function has the signature function():String.
 
validateNow:Boolean (default = false)

Returns
LinkablePromise

See also

weave.api.core.IStageUtils.startTask()
validate()method 
public function validate():void

If this LinkablePromise is set to lazy mode, this will switch it to non-lazy mode and automatically invoke the async task when necessary.