Class TaskGroup
Defined in: | src/lib/taskgroup.coffee |
Inherits: | Interface |
Overview
Our TaskGroup class.
Available configuration is documented in ::setConfig.
Available events:
started()
- emitted when we start executionrunning()
- emitted when the first item starts executionfailed(err)
- emitted when execution exited with a failurepassed()
- emitted when execution exited with a successcompleted(err, results)
- emitted when execution exited,results
is an Array of the result arguments for each item that executederror(err)
- emtited if an unexpected error occured within ourselfdone(err, results)
- emitted when either the execution completes (thecompleted
event) or when an unexpected error occurs (theerror
event)item.*(...)
- bubbled events from an added itemtask.*(...)
- bubbled events from an added Taskgroup.*(...)
- bubbled events from an added TaskGroup
Available internal statuses:
null
- execution has not yet started'started'
- execution has begun'running'
- execution of items has begun'failed'
- execution has exited with failure status'passed'
- execution has exited with success status'destroyed'
- we've been destroyed and can no longer execute
Class Method Summary
- TaskGroup .create(args...) Creates a new TaskGroup instance.
- Boolean .isTaskGroup(group) A helper method to check if the passed argument is an instanceof a TaskGroup.
Instance Method Summary
- ::addGroup(args...) Add a TaskGroup with some configuration to ourself, create it if needed.
- ::addGroups(items, args...) Add TaskGroups with some configuration to ourself, create it if needed.
- ::addTask(args...) Add a Task with some configuration to ourself, create it if needed.
- ::addTasks(items, args...) Add Tasks with some configuration to ourself, create it if needed.
- ::clear() Clear remaning items.
- ::constructor(args...) Initialize our new TaskGroup instance.
- TaskGroup ::createGroup(args...) Create a TaskGroup instance from some configuration.
- Task ::createTask(args...) Create a Task instance from some configuration.
- ::destroy() Destroy all remaining items and remove listeners.
- Object ::getItemNames() Gets the names of the items, the total number of items, and their results for the purpose of debugging.
- Object ::getItemTotals() Gets the total number count of each of our item lists.
- Number ::getItemsTotal() Gets the total number of items
- Boolean ::hasExited() Have we finished its execution yet?
- Boolean ::hasItems() Whether or not we have any items
- Boolean ::hasRemaining() Whether or not we have any items that are yet to execute
- Boolean ::hasRunning() Whether or not we have any running items
- Boolean ::hasStarted() Have we started execution yet?
- Boolean ::isComplete() Have we completed its execution yet? Completion of executed is determined of whether or not we have started, and whether or not we are currently paused or have no remaining and running items left
- Boolean ::isEmpty() Whether or not we have no items left
- ::onceDone(handler) Once Done Promise.
- ::run(args...) Start the execution.
- ::setConfig(opts = {}) Set the configuration for our instance.
- ::setNestedConfig(config = {}) Set Nested Config
- ::setNestedTaskConfig(config = {}) Set Nested Task Config
- ::whenDone(handler) When Done Promise.
Inherited Method Summary
Methods inherited from Interface
.whenDone, .onceDone, .done, .getNames, .getName, .getConfig
Class Method Details
Constructor Details
::constructor(args...) Source
Initialize our new TaskGroup instance. Forwards arguments onto ::setConfig.
Instance Method Details
::addGroups(items, args...) Source
Add TaskGroups with some configuration to ourself, create it if needed.
::addTasks(items, args...) Source
Add Tasks with some configuration to ourself, create it if needed.
::clear() Source
Clear remaning items.
TaskGroup ::createGroup(args...) Source
Task ::createTask(args...) Source
::destroy() Source
Destroy all remaining items and remove listeners.
Object ::getItemNames() Source
Gets the names of the items, the total number of items, and their results for the purpose of debugging.
Object ::getItemTotals() Source
Gets the total number count of each of our item lists.
Number ::getItemsTotal() Source
Gets the total number of items
Boolean ::hasExited() Source
Have we finished its execution yet?
Boolean ::hasItems() Source
Whether or not we have any items
Boolean ::hasRemaining() Source
Whether or not we have any items that are yet to execute
Boolean ::hasRunning() Source
Whether or not we have any running items
Boolean ::hasStarted() Source
Have we started execution yet?
Boolean ::isComplete() Source
Have we completed its execution yet?
Completion of executed is determined of whether or not we have started, and whether or not we are currently paused or have no remaining and running items left
Boolean ::isEmpty() Source
Whether or not we have no items left
::onceDone(handler) Source
Once Done Promise. Fires the listener once, either on the next tick if we are already done, or if not, once the done
event fires.
::run(args...) Source
Start the execution.
::setConfig(opts = {}) Source
::setNestedConfig(config = {}) Source
Set Nested Config
::setNestedTaskConfig(config = {}) Source
Set Nested Task Config
::whenDone(handler) Source
When Done Promise. Fires the listener, either on the next tick if we are already done, or if not, each time the done
event fires.