new BatchTask( [mode] [, actions])
Batchs a serie of actions and run it in the same time.
Batchs a serie of actions and run it in the same time.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
mode |
string |
<optional> |
normal | Specifies the |
actions |
array |
<optional> |
null | An optional array who contains Action references to initialize the chain. |
Example
var do1 = new system.process.Do() ; var do2 = new system.process.Do() ; do1.something = function() { console.log( "do1 something" ) ; } do2.something = function() { console.log( "do2 something" ) ; } var finish = function( action ) { trace( "finish: " + action ) ; }; var start = function( action ) { trace( "start: " + action ) ; }; var batch = new system.process.BatchTask() ; batch.add( do1 ) ; batch.add( do2 ) ; batch.verbose = true ; trace( 'batch : ' + batch.toString(true) ) ; trace( 'running : ' + batch.running ) ; trace( 'length : ' + batch.length ) ; batch.finishIt.connect(finish) ; batch.startIt.connect(start) ; batch.run() ;
Extends
Members
-
<constant> changeIt :system.signals.Signal
-
The signal emit when the task is changed.
Type:
- Inherited From:
-
<constant> clearIt :system.signals.Signal
-
The signal emit when the task is cleared.
Type:
- Inherited From:
-
<readonly> current :system.process.Action
-
Indicates the current Action reference when the batch is in progress.
Type:
-
<constant> finishIt :system.signals.Signal
-
This signal emit when the action is finished.
Type:
- Inherited From:
-
<constant> infoIt :system.signals.Signal
-
The signal emit when the task emit a message.
Type:
- Inherited From:
-
<readonly> length
-
Indicates the numbers of actions register in the group.
- Inherited From:
-
looping :boolean
-
The flag to determinate if the task must be looped.
Type:
- boolean
- Inherited From:
- Default Value:
-
- false
-
<constant> loopIt :system.signals.Signal
-
The signal emit when the task is looped.
Type:
- Inherited From:
-
mode
-
Determinates the mode of the chain. The mode can be
"normal"
,"transient"
or"everlasting"
.- Inherited From:
- See:
-
system.process.TaskGroup#NORMAL
,system.process.TaskGroup#EVERLASTING
,system.process.TaskGroup#TRANSIENT
-
<constant> pauseIt :system.signals.Signal
-
The signal emit when the task is paused.
Type:
- Inherited From:
-
<readonly> phase :string
-
Indicates the current phase.
Type:
- string
- Inherited From:
- See:
-
<constant> progressIt :system.signals.Signal
-
The signal emit when the task is in progress.
Type:
- Inherited From:
-
<constant> resumeIt :system.signals.Signal
-
The signal emit when the task is resumed.
Type:
- Inherited From:
-
<readonly> running :boolean
-
Indicates action is running.
Type:
- boolean
- Inherited From:
-
<constant> startIt :system.signals.Signal
-
This signal emit when the action is started.
Type:
- Inherited From:
-
<constant> stopIt :system.signals.Signal
-
This signal emit when the task is stopped.
Type:
- Inherited From:
-
<readonly> stopped
-
Indicates if the chain is stopped.
- Inherited From:
-
<constant> timeoutIt :system.signals.Signal
-
The signal emit when the task is out of time.
Type:
- Inherited From:
-
verbose :boolean
-
Indicates if the toString method must be verbose or not.
Type:
- boolean
- Inherited From:
- Default Value:
-
false
Methods
-
add(action [, priority] [, autoRemove])
-
Adds an action in the chain.
Parameters:
Name Type Argument Default Description action
system.process.Action The
Action
to register in this collection.priority
number <optional>
0 Determinates the priority level of the action in the chain.
autoRemove
boolean <optional>
false Apply a remove after the first finish notification.
- Inherited From:
Returns:
true
if the insert is success. -
clone()
-
Returns a shallow copy of this object.
- Overrides:
Returns:
a shallow copy of this object.
-
contains()
-
Returns
true
if the specified Action is register in the group.- Inherited From:
Returns:
true
if the specified Action is register in the group. -
dispose()
-
Dispose the chain and disconnect all actions but don't remove them.
- Inherited From:
-
get(index)
-
Gets the
Action
register in the collection at the specified index value ornull
.Parameters:
Name Type Description index
number The index of the action element in the collection.
- Inherited From:
Returns:
the action register in the chain at the specified index value or
null
. -
isEmpty()
-
Returns
true
if the collection is empty.- Inherited From:
Returns:
true
if the chain is empty. -
isLocked()
-
Returns
true
if the object is locked.- Inherited From:
- Implements:
Returns:
true
if the object is locked. -
lock()
-
Locks the object.
- Inherited From:
- Implements:
-
notifyChanged()
-
Notify when the process is changed.
- Inherited From:
-
notifyCleared()
-
Notify when the process is cleared.
- Inherited From:
-
notifyFinished()
-
Notify when the process is finished.
- Inherited From:
-
notifyInfo()
-
Notify a specific information when the process is changed.
- Inherited From:
-
notifyLooped()
-
Notify when the process is looped.
- Inherited From:
-
notifyPaused()
-
Notify when the process is paused.
- Inherited From:
-
notifyProgress()
-
Notify when the process is progress.
- Inherited From:
-
notifyResumed()
-
Notify when the process is resumed.
- Inherited From:
-
notifyStarted()
-
Notify when the process is started.
- Inherited From:
-
notifyStopped()
-
Notify when the process is stopped.
- Inherited From:
-
notifyTimeout()
-
Notify when the process is out of time.
- Inherited From:
-
remove(action)
-
Removes a specific action register in the chain and if the passed-in argument is null all actions register in the chain are removed. If the chain is running the
stop()
method is called.Parameters:
Name Type Description action
system.process.Action The action to remove in the collection.
- Inherited From:
Returns:
true
if the method succeeded. -
reset()
-
Resets the task.
- Inherited From:
- Implements:
-
resume()
-
Resume the chain.
- Overrides:
-
run()
-
Launchs the chain process.
- Overrides:
-
start()
-
Starts the task.
- Inherited From:
- Implements:
-
stop()
-
Stops the task group.
- Overrides:
-
toArray()
-
Invoked when a task is finished.
- Inherited From:
- Overrides:
-
toString()
-
Returns the String representation of the chain.
- Inherited From:
Returns:
the String representation of the chain.
-
unlock()
-
Unlocks the object.
- Inherited From:
- Implements: