Class: TaskFactory

TaskFactory()

new TaskFactory()

Factory used for instantiating Tasks and Task Groups. Mostly for internal use, but some public APIs exposed via the Task Modifier APIs.

Source:

Methods

(protected) createTask(context) → {Task}

Returns a new Task bound to the given context

Parameters:
Name Type Description
context *
Source:
Returns:
Type
Task

(protected) createTaskGroup(context) → {Task}

Returns a new TaskGroup bound to the given context

Parameters:
Name Type Description
context *
Source:
Returns:
Type
Task

(protected) getModifier(name) → (nullable) {TaskFactory~TaskModifier}

Returns a modifier callback with the given name bound to this TaskFactory, if registered.

Parameters:
Name Type Description
name string
Source:
Returns:
Type
TaskFactory~TaskModifier

getOptions() → {object}

Returns the options provided to TaskFactory

Source:
Returns:
Type
object

(protected) getScheduler(schedulerPolicy, stateTrackingEnabled) → {Scheduler}

Returns a new Scheduler instance

Parameters:
Name Type Description
schedulerPolicy *
stateTrackingEnabled boolean
Source:
Returns:
Type
Scheduler

(protected) getTaskOptions(context) → {object}

Returns the options to pass to a Task or TaskGroup constructor

Parameters:
Name Type Description
context *
Source:
Returns:
Type
object

setBufferPolicy(policy) → {TaskFactory}

Sets the Scheduler buffer policy class to the specified value.

Will raise an assertion if a buffer policy has already been specified

Parameters:
Name Type Description
policy *
Source:
Returns:
Type
TaskFactory

setDebug(enabled) → {TaskFactory}

Sets debug mode

Parameters:
Name Type Description
enabled boolean
Source:
Returns:
Type
TaskFactory

setEvented(enabled) → {TaskFactory}

Sets whether Task will dispatch Task events or not

Parameters:
Name Type Description
enabled boolean
Source:
Returns:
Type
TaskFactory

setGroup(group) → {TaskFactory}

Assigns Task created from this factory to the specified group name

Parameters:
Name Type Description
group string
Source:
Returns:
Type
TaskFactory

setMaxConcurrency(maxConcurrency) → {TaskFactory}

Sets Scheduling policy's maxConcurrency

Parameters:
Name Type Description
maxConcurrency number
Source:
Returns:
Type
TaskFactory

setName(name) → {TaskFactory}

Sets the name of tasks created from this factory

Parameters:
Name Type Description
name string
Source:
Returns:
Type
TaskFactory

setOnState(onStateCallback) → {TaskFactory}

Sets the callback used on state updates. Can be set to null to disable state tracking on tasks.

Parameters:
Name Type Description
onStateCallback function
Source:
Returns:
Type
TaskFactory

setTaskDefinition(taskDefinition) → {TaskFactory}

Sets the definition for tasks created from this factory

Parameters:
Name Type Description
taskDefinition *
Source:
Returns:
Type
TaskFactory

Type Definitions

TaskModifier(factory, taskModifierOption)

Callback type defining a task modifier

Parameters:
Name Type Description
factory TaskFactory
taskModifierOption *
Source: