Packagecom.rosettastone.library.taskmanager
Interfacepublic interface IInterruptibleTask extends ITask, flash.events.IEventDispatcher
Implementors InterruptibleCompositeTask, InterruptibleTask, InterruptibleTaskManager, SynchronousTask, SynchronousTaskWithClosure

An interruptible Task can be paused and resumed after being run. Pausing a non-running Task should have no effect. Resuming a non-interrupted Task should have no effect.



Public Properties
 PropertyDefined By
 Inheriteddata : *
[read-only] Optional data parameter passed to the Task complete/error/interruption method.
ITask
  interruptingTask : ITask
[read-only] The Task currently interrupting the this Task's execution (or NULL if no such Task exists).
IInterruptibleTask
 InheritedisComplete : Boolean
[read-only] The current task has successfully completed execution.
ITask
 InheritedisErrored : Boolean
[read-only] The current task failed.
ITask
  isInterrupted : Boolean
[read-only] The task has been interrupted and has not yet resumed.
IInterruptibleTask
 InheritedisRunning : Boolean
[read-only] The task is currently running.
ITask
 Inheritedmessage : String
[read-only] Optional message parameter passed to the task complete/error/interruption method.
ITask
 InheritednumInternalOperations : int
[read-only] Number of internal operations conducted by this task.
ITask
 InheritednumInternalOperationsCompleted : int
[read-only] Number of internal operations that have completed.
ITask
 InheritednumInternalOperationsPending : int
[read-only] Number of internal operations not yet completed.
ITask
 InheritednumTimesCompleted : int
[read-only] Number of times this task has completed.
ITask
 InheritednumTimesErrored : int
[read-only] Number of times this task has errored.
ITask
 InheritednumTimesInterrupted : int
[read-only] Number of times this task has been interrupted.
ITask
 InheritednumTimesReset : int
[read-only] Number of times this task has been reset.
ITask
 InheritednumTimesStarted : int
[read-only] Number of times this task has been started.
ITask
 Inheritedrunning : Boolean
[read-only] The task is currently running.
ITask
 Inheritedsynchronous : Boolean
[read-only] The current task can be executed synchronously.
ITask
 InheritedtaskIdentifier : String
(Optional) human-readable label for task.
ITask
 InheriteduniqueID : Number
[read-only] Unique ID for a task.
ITask
Public Methods
 MethodDefined By
 Inherited
and(... chainedTasks):ITask
Executes the specified tasks when the current task is executed.
ITask
  
If an interrupting-Task has been provided (via interruptForTask) this Task will automatically resume when it completes.
IInterruptibleTask
  
interrupt():Boolean
Interrupt the current Task.
IInterruptibleTask
  
interruptForTask(interruptingTask:ITask):Boolean
Interrupts the current Task to wait on the Task specified.
IInterruptibleTask
 Inherited
or(... chainedTasks):ITask
Executes the specified tasks if the current task fails.
ITask
 Inherited
reset():void
Resets the task to it's pre-run state.
ITask
 Inherited
Starts a task.
ITask
 Inherited
then(... chainedTasks):ITask
Executes the specified tasks once the current task has completed successfully.
ITask
 Inherited
withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes.
ITask
 Inherited
withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes.
ITask
 Inherited
withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task.
ITask
  
withInterruptionHandler(interruptionHandler:Function):ITask
Although Tasks dispatch TaskEvents to indicate interruption this method may also be used for notification purposes.
IInterruptibleTask
 Inherited
withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes.
ITask
Events
 Event Summary Defined By
  IInterruptibleTask
Property Detail
interruptingTaskproperty
interruptingTask:ITask  [read-only]

The Task currently interrupting the this Task's execution (or NULL if no such Task exists).


Implementation
    public function get interruptingTask():ITask
isInterruptedproperty 
isInterrupted:Boolean  [read-only]

The task has been interrupted and has not yet resumed.


Implementation
    public function get isInterrupted():Boolean
Method Detail
disconnectFromInterruptingTask()method
public function disconnectFromInterruptingTask():void

If an interrupting-Task has been provided (via interruptForTask) this Task will automatically resume when it completes. This method to cancels that behavior by removing references and event listeners.

interrupt()method 
public function interrupt():Boolean

Interrupt the current Task. Interruptions should be handled in such a way as to allow a subsequent call to run() to resume gracefully. This mehtod should trigger an event of type TaskEvent.INTERRUPTED.

Returns
Boolean — TRUE if the Task has been successfully interrupted
interruptForTask()method 
public function interruptForTask(interruptingTask:ITask):Boolean

Interrupts the current Task to wait on the Task specified. Once this Task dispatches a TaskEvent.COMPLETE event, this Task will resume. If the specified Task dispatches a TaskEvent.ERROR event this Task will also error. TaskEvent.INTERRUPTED events are ignored. If this method is called once with a Task and then called again before that Task has completed, Event listeners will be removed from the first Task and added to the second one. There can only be 1 active interrupting Task at a time. If this Task should be interrupted by more than one Task, a CompositeTask or ObserverTask should be used. If the specified interrupting Task is already running this method will simply add event listeners. If it is not running this method will add event listeners but will rely on external code to run the interrupter.

Parameters

interruptingTask:ITask — Task

Returns
Boolean — TRUE if the Task has been successfully interrupted
withInterruptionHandler()method 
public function withInterruptionHandler(interruptionHandler:Function):ITask

Although Tasks dispatch TaskEvents to indicate interruption this method may also be used for notification purposes. The provided function will be invoked only upon interruption of the Task. This method may be called multiple times safely; each unique function specified will be executed once if the task interrupts.

It should have one of the following signatures:

function( message:String = "", data:= null ):void
function():void

Parameters

interruptionHandler:Function — Function

Returns
ITask
Event Detail
taskEventInterrupted Event
Event Object Type: com.rosettastone.library.taskmanager.events.TaskEvent