Package | com.rosettastone.library.taskmanager |
Interface | public interface ITask extends flash.events.IEventDispatcher |
Implementors | Task |
Property | Defined By | ||
---|---|---|---|
data : * [read-only]
Optional data parameter passed to the Task complete/error/interruption method. | ITask | ||
isComplete : Boolean [read-only]
The current task has successfully completed execution. | ITask | ||
isErrored : Boolean [read-only]
The current task failed. | ITask | ||
isRunning : Boolean [read-only]
The task is currently running. | ITask | ||
message : String [read-only]
Optional message parameter passed to the task complete/error/interruption method. | ITask | ||
numInternalOperations : int [read-only]
Number of internal operations conducted by this task. | ITask | ||
numInternalOperationsCompleted : int [read-only]
Number of internal operations that have completed. | ITask | ||
numInternalOperationsPending : int [read-only]
Number of internal operations not yet completed. | ITask | ||
numTimesCompleted : int [read-only]
Number of times this task has completed. | ITask | ||
numTimesErrored : int [read-only]
Number of times this task has errored. | ITask | ||
numTimesInterrupted : int [read-only]
Number of times this task has been interrupted. | ITask | ||
numTimesReset : int [read-only]
Number of times this task has been reset. | ITask | ||
numTimesStarted : int [read-only]
Number of times this task has been started. | ITask | ||
running : Boolean [read-only]
The task is currently running. | ITask | ||
synchronous : Boolean [read-only]
The current task can be executed synchronously. | ITask | ||
taskIdentifier : String
(Optional) human-readable label for task. | ITask | ||
uniqueID : Number [read-only]
Unique ID for a task. | ITask |
Method | Defined By | ||
---|---|---|---|
Executes the specified tasks when the current task is executed. | ITask | ||
Executes the specified tasks if the current task fails. | ITask | ||
reset():void
Resets the task to it's pre-run state. | ITask | ||
Starts a task. | ITask | ||
Executes the specified tasks once the current task has completed successfully. | ITask | ||
withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes. | ITask | ||
withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes. | ITask | ||
withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task. | ITask | ||
withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes. | ITask |
Event | Summary | Defined By | ||
---|---|---|---|---|
ITask | ||||
ITask | ||||
ITask | ||||
ITask | ||||
ITask |
data | property |
data:*
[read-only] Optional data parameter passed to the Task complete/error/interruption method.
public function get data():*
isComplete | property |
isComplete:Boolean
[read-only] The current task has successfully completed execution.
public function get isComplete():Boolean
isErrored | property |
isErrored:Boolean
[read-only] The current task failed.
public function get isErrored():Boolean
isRunning | property |
isRunning:Boolean
[read-only] The task is currently running. This value is FALSE if the task has not been run, has completed run (succesfully or due to a failure), or has been interrupted.
public function get isRunning():Boolean
message | property |
message:String
[read-only] Optional message parameter passed to the task complete/error/interruption method.
public function get message():String
numInternalOperations | property |
numInternalOperations:int
[read-only] Number of internal operations conducted by this task. Sub-classes should override this method if containing a value > 1; If value > 1, task should dispatch ProgressEvent.PROGRESS events manually to indicate changes in numInternalOperationsCompleted. If value == 1, task will automatically dispatching ProgressEvent.PROGRESS events.
public function get numInternalOperations():int
numInternalOperationsCompleted | property |
numInternalOperationsCompleted:int
[read-only] Number of internal operations that have completed. Sub-classes should override this method if containing a value > 1;
public function get numInternalOperationsCompleted():int
numInternalOperationsPending | property |
numInternalOperationsPending:int
[read-only] Number of internal operations not yet completed.
public function get numInternalOperationsPending():int
numTimesCompleted | property |
numTimesCompleted:int
[read-only] Number of times this task has completed.
public function get numTimesCompleted():int
numTimesErrored | property |
numTimesErrored:int
[read-only] Number of times this task has errored.
public function get numTimesErrored():int
numTimesInterrupted | property |
numTimesInterrupted:int
[read-only] Number of times this task has been interrupted.
public function get numTimesInterrupted():int
numTimesReset | property |
numTimesReset:int
[read-only] Number of times this task has been reset. This is the only counter that is not reset by the reset() method.
public function get numTimesReset():int
numTimesStarted | property |
numTimesStarted:int
[read-only] Number of times this task has been started.
public function get numTimesStarted():int
running | property |
running:Boolean
[read-only] The task is currently running. This value is FALSE if the task has not been run, has completed run (succesfully or due to a failure), or has been interrupted.
public function get running():Boolean
synchronous | property |
synchronous:Boolean
[read-only] The current task can be executed synchronously.
public function get synchronous():Boolean
taskIdentifier | property |
taskIdentifier:String
(Optional) human-readable label for task.
public function get taskIdentifier():String
public function set taskIdentifier(value:String):void
uniqueID | property |
uniqueID:Number
[read-only] Unique ID for a task.
public function get uniqueID():Number
and | () | method |
public function and(... chainedTasks):ITask
Executes the specified tasks when the current task is executed. If the current task has already been started the new tasks will be executed immediately. Failures or interruptions in the current task will not affect the chained tasks.
Parameters
... chainedTasks — One or more tasks
|
ITask |
Error — if any parameter is not a task
|
var initialTask:StubTask = new StubTask(); var parallelTask:StubTask = new StubTask(); initialTask.and( parallelTask ).run();
or | () | method |
public function or(... chainedTasks):ITask
Executes the specified tasks if the current task fails.
Parameters
... chainedTasks — One or more tasks
|
ITask |
Error — if any parameter is not a task
|
var initialTask:StubTask = new StubTask(); var fallbackTask:StubTask = new StubTask(); initialTask.or( fallbackTask ).run();
reset | () | method |
public function reset():void
Resets the task to it's pre-run state. This allows it to be re-run. This method can only be called on non-running tasks.
run | () | method |
public function run():ITask
Starts a task. This method will dispatch a TaskEvent.STARTED to indicate that the task has begun. This method may also be used to retry/resume an errored task.
ReturnsITask |
then | () | method |
public function then(... chainedTasks):ITask
Executes the specified tasks once the current task has completed successfully.
Parameters
... chainedTasks — One or more tasks
|
ITask |
Error — if any parameter is not a task
|
var firstTask:StubTask = new StubTask(); var secondTask:StubTask = new StubTask(); firstTask.then( secondTask ).run();
withCompleteHandler | () | method |
public function withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes. The provided function will be invoked only upon successful completion of the task. This method may be called multiple times safely; each unique function specified will be executed once when the task completes.
It should have one of the following signatures:
function( message:String = "", data:= null ):void
function():void
Parameters
completeHandler:Function — Function
|
ITask |
withErrorHandler | () | method |
public function withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes. The provided function will be invoked only upon failure of the task. This method may be called multiple times safely; each unique function specified will be executed once if the tasks errors.
It should have one of the following signatures:
function( message:String = "", data:= null ):void
function():void
Parameters
errorHandler:Function — Function
|
ITask |
withFinalHandler | () | method |
public function withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task. It can be used for cleanup that must be done regardless of Task-status.
This method may be called multiple times safely. Each unique function specified will be executed once when the task is ready for cleanup.
This type of closure should implement the following signature:
function():void
Parameters
finalHandler:Function |
ITask |
withStartedHandler | () | method |
public function withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes. The provided function will be invoked each time the task is started (or re-started). This method may be called multiple times safely; each unique function specified will be executed once when the task starts.
It should have the following signature:
function():void
Parameters
startedHandler:Function — Function
|
ITask |
progress | Event |
flash.events.ProgressEvent
taskEventComplete | Event |
taskEventError | Event |
taskEventFinal | Event |
taskEventStarted | Event |