Methods
start
start(): boolean- Start the runner and begin execution of tasks
- Returns
falseif the runner is busy or destroyed - The
startmethod 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
falseif the runner is destroyed - The
startmethod 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
-1would run all tasks at once - If concurrency is not bound, throws a
RangeError
add
add(task: TaskWithDone<T>, prepend?: boolean): voidType:
TaskWithDone- Add a task to end of the pending list
- Passing
trueas the second argument will add the task to the beginning of the pending list
addFirst
addFirst(task: TaskWithDone<T>): voidType:
TaskWithDone- Add a task to the beginning of the pending list
- Alias for
addwith the second argument astrue
addAt
addAt(index: number, task: TaskWithDone<T>): voidType:
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): voidType:
TasksWithDone- Add multiple tasks to end of the pending list
- Passing
trueas the second argument will add the tasks to the beginning of the pending list
addMultipleFirst
addMultipleFirst(tasks: TasksWithDone<T>): voidType:
TasksWithDone- Add multiple tasks to the beginning of the pending list
- Alias for
addMultiplewith the second argument astrue
remove
remove(first?: boolean): void- Remove the task at the end of the pending list
- Passing
trueas 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
removewith 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