Methods
start
start(): boolean
- Start the runner and begin execution of tasks
- Returns
false
if the runner is busy or destroyed - The
start
method can be used to unpause the runner
pause
pause(): boolean
- Pauses the runner instance
- Running tasks are unaffected
- Once all running tasks are done, the runner will be marked as idle
- Returns
false
if the runner is destroyed - The
start
method can be used to unpause the runner
destroy
destroy(): void
- Destroys the runner instance
- Running tasks are unaffected
- Once all running tasks are done, the runner will be marked as idle
setConcurrency
setConcurrency(concurrency: number): void
- Sets the concurrency of the runner
- Concurrency should be a positive integer, or
-1
- Setting concurrency as
-1
would run all tasks at once - If concurrency is not bound, throws a
RangeError
add
add(task: TaskWithDone<T>, prepend?: boolean): void
Type:
TaskWithDone
- Add a task to end of the pending list
- Passing
true
as the second argument will add the task to the beginning of the pending list
addFirst
addFirst(task: TaskWithDone<T>): void
Type:
TaskWithDone
- Add a task to the beginning of the pending list
- Alias for
add
with the second argument astrue
addAt
addAt(index: number, task: TaskWithDone<T>): void
Type:
TaskWithDone
- Add a task at a particular index to the pending list
- Index should always be bound, otherwise throws a
RangeError
addMultiple
addMultiple(tasks: TasksWithDone<T>, prepend?: boolean): void
Type:
TasksWithDone
- Add multiple tasks to end of the pending list
- Passing
true
as the second argument will add the tasks to the beginning of the pending list
addMultipleFirst
addMultipleFirst(tasks: TasksWithDone<T>): void
Type:
TasksWithDone
- Add multiple tasks to the beginning of the pending list
- Alias for
addMultiple
with the second argument astrue
remove
remove(first?: boolean): void
- Remove the task at the end of the pending list
- Passing
true
as the first argument will remove the task at the beginning of the pending list
removeFirst
removeFirst(): void
- Remove the task at the beginning of the pending list
- Alias for
remove
with the first argument astrue
removeAt
removeAt(index: number): void
- Remove a task at a particular index
- Index should always be bound, otherwise throws a
RangeError
removeRange
removeRange(start: number, count: number): void
- Remove tasks at a particular range from the pending list
- The count is inclusive of the starting index
- Starting index should always be bound, otherwise throws a
RangeError
removeAll
removeAll(): void
- Remove all tasks from the pending list