This module defines a common interface to be used to implement a task executor singleton.
The implementation should guarantee that, given two tasks to be executed at the same time, they are served in a FIFO fashion.
The implementation should guarantee that, given two tasks to be executed at the same time, they are served in a FIFO fashion.
Method Summary
- addPackedTimedTask
- Queue a previously generated task for later execution.
- addRepetitiveTask
- Creates and enqueue a Task to be executed at fixed intervals.
- addTimedTask
- Creates and enqueue a Task to be later executed.
- delayTask
- Delays the execution of a task.
- executeTask
- Executed a previously generated task.
- getQueueLength
- Get the number of tasks in the executor queue.
- modifyAllTaskParams
- Replaces the parameters array for a specified task.
- modifyTaskParam
- Replaces one of the parameters of a specified task.
- packTask
- Creates a task object to be later executed.
- stopRepetitiveTask
- Stop the executions of a repetitive task.
Method Detail
-
<static> addPackedTimedTask(task, time, repetitive)
-
Queue a previously generated task for later execution.
Parameters:
Name Type Argument Default Description taskTask the task to be queued. timeNumber the time that should be waited before executing the task. If the repetitive flag is true this time specifies the interval between two executions. repetitiveBoolean <optional>
false true if the task has to be executed at fixed intervals, false if it has to be executed only once. -
<static> addRepetitiveTask(fun, interval, context, params)
-
Creates and enqueue a Task to be executed at fixed intervals.
Parameters:
Name Type Argument Description funfunction the function to be executed. intervalNumber the time that should be waited between each task execution. contextObject <optional>
the object to be used as context for the function call. paramsArray <optional>
the parameters to be passed to the function. - See:
-
- stopRepetitiveTask
-
<static> addTimedTask(fun, time, context, params, repetitive)
-
Creates and enqueue a Task to be later executed.
Parameters:
Name Type Argument Default Description funfunction the function to be executed. timeNumber the time that should be waited before executing the task. If the repetitive flag is true this time specifies the interval between two executions. contextObject <optional>
the object to be used as context for the function call. paramsArray <optional>
the parameters to be passed to the function. repetitiveBoolean <optional>
false true if the task has to be executed at fixed intervals, false if it has to be executed only once. -
<static> delayTask(task, delay)
-
Delays the execution of a task.
Parameters:
Name Type Description taskTask the task to be delayed. delayNumber the extra time that should be waited before executing the task. -
<static> executeTask(task, extParams)
-
Executed a previously generated task.
Parameters:
Name Type Argument Description taskTask the task to be executed. extParamsArray <optional>
an array of params to replace the task's own array. If missing the original array is used. - See:
-
- packTask
-
<static> getQueueLength() → {Number}
-
Get the number of tasks in the executor queue.
Returns:
the number of task to be executed.- Type
- Number
-
<static> modifyAllTaskParams(task, extParams)
-
Replaces the parameters array for a specified task.
Parameters:
Name Type Description taskTask the task to be modified. extParamsArray the new array to be passed to the task. -
<static> modifyTaskParam(task, index, newParam)
-
Replaces one of the parameters of a specified task.
Parameters:
Name Type Description taskTask the task to be modified. indexNumber the 0-based index within the previously specified array of parameters to be replaced. newParamObject the value to replace the previous parameter. -
<static> packTask(fun, context, params) → {Task}
-
Creates a task object to be later executed.
Note: the task is not queued for execution.
The returned object does not need to be cross-compatible with other ExecutorInterface implementation: only the involved implementation is supposed to accept the generated task.Parameters:
Name Type Argument Description funfunction the function to be executed. contextObject <optional>
the object to be used as context for the function call. paramsArray <optional>
the parameters to be passed to the function. Returns:
an object representing the task to be executed.- Type
- Task
-
<static> stopRepetitiveTask(task)
-
Stop the executions of a repetitive task.
Parameters:
Name Type Description taskTask the task to be stopped.