<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [Collection](#collection)
    -   [constructor](#constructor)
    -   [attach](#attach)
    -   [detach](#detach)
    -   [get](#get)
    -   [push](#push)
    -   [unshift](#unshift)
    -   [remove](#remove)
    -   [run](#run)
    -   [stop](#stop)
    -   [reset](#reset)
    -   [\_complete](#_complete)
    -   [\_recover](#_recover)
    -   [\_chainTask](#_chaintask)
    -   [\_unchainTask](#_unchaintask)
    -   [\_postTaskAdds](#_posttaskadds)
    -   [running](#running)
    -   [current](#current)
    -   [passed](#passed)
    -   [autoRun](#autorun)
    -   [autoRun](#autorun-1)
-   [Limiter](#limiter)
    -   [constructor](#constructor-1)
    -   [\_runCondition](#_runcondition)
    -   [\_taskComplete](#_taskcomplete)
-   [Loop](#loop)
    -   [constructor](#constructor-2)
    -   [\_complete](#_complete-1)
    -   [\_\_next](#__next)
    -   [passed](#passed-1)
-   [Parallel](#parallel)
    -   [constructor](#constructor-3)
    -   [run](#run-1)
    -   [\_run](#_run)
    -   [\_runCondition](#_runcondition-1)
    -   [\_taskComplete](#_taskcomplete-1)
    -   [stop](#stop-1)
    -   [reset](#reset-1)
    -   [current](#current-1)
    -   [passed](#passed-2)
-   [Sequence](#sequence)
    -   [constructor](#constructor-4)
    -   [run](#run-2)
    -   [stop](#stop-2)
    -   [reset](#reset-2)
    -   [\_next](#_next)
    -   [\_complete](#_complete-2)
    -   [\_recover](#_recover-1)
    -   [\_resetCurrent](#_resetcurrent)
    -   [\_\_next](#__next-1)
    -   [current](#current-2)
    -   [passed](#passed-3)
-   [AsyncMap](#asyncmap)
    -   [match](#match)
-   [Factory](#factory)
    -   [\_CHAIN\_](#_chain_)
    -   [maps](#maps)
    -   [attached](#attached)
    -   [initialized](#initialized)
    -   [task](#task)
    -   [sequence](#sequence-1)
    -   [parallel](#parallel-1)
    -   [loop](#loop-1)
    -   [limiter](#limiter-1)
    -   [initialize](#initialize)
    -   [map](#map)
    -   [unmap](#unmap)
    -   [unmapAll](#unmapall)
    -   [attach](#attach-1)
    -   [detach](#detach-1)
    -   [get](#get-1)
-   [Map](#map-1)
    -   [match](#match-1)
-   [Match](#match-2)
    -   [constructor](#constructor-5)
    -   [percentage](#percentage)
    -   [percentage](#percentage-1)
-   [PromiseMap](#promisemap)
    -   [match](#match-3)
-   [RawMap](#rawmap)
    -   [match](#match-4)
-   [TimeoutMap](#timeoutmap)
    -   [match](#match-5)
-   [TriggerMap](#triggermap)
    -   [match](#match-6)
-   [AsyncTask](#asynctask)
    -   [constructor](#constructor-6)
    -   [run](#run-3)
-   [Injector](#injector)
    -   [afterComplete](#aftercomplete)
    -   [resetAfterComplete](#resetaftercomplete)
    -   [addChainGetter](#addchaingetter)
    -   [removeChainGetter](#removechaingetter)
-   [PromiseTask](#promisetask)
    -   [constructor](#constructor-7)
    -   [run](#run-4)
    -   [\_isPromise](#_ispromise)
    -   [\_setPromise](#_setpromise)
    -   [\_promiseFinally](#_promisefinally)
-   [Task](#task-1)
    -   [constructor](#constructor-8)
    -   [attach](#attach-2)
    -   [detach](#detach-2)
    -   [get](#get-2)
    -   [run](#run-5)
    -   [complete](#complete)
    -   [recover](#recover)
    -   [stop](#stop-3)
    -   [restart](#restart)
    -   [running](#running-1)
    -   [done](#done)
    -   [failed](#failed)
    -   [exceptions](#exceptions)
-   [TimeoutTask](#timeouttask)
    -   [constructor](#constructor-9)
    -   [run](#run-6)
    -   [complete](#complete-1)
    -   [stop](#stop-4)
-   [TriggerTask](#triggertask)
    -   [constructor](#constructor-10)
    -   [run](#run-7)

## Collection

Collection. Abstract class.

Basic collection class. Do NOT instantiate directly.

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### constructor

Task constructor

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### attach

Attaches variable with a key

Used to avoid using global variables or trying to scope
in some way. After attach() you can get().
Attach will also keep the variable from GC.

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable
-   `value` **any** variable value

### detach

Detaches variable with a key

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

### get

Gets variable with a key

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

Returns **any** value variable value

### push

Pushes task to the collection

**Parameters**

-   `task` **[Task](#task)** task to push

Returns **[Collection](#collection)** collection current collection

### unshift

Unshifts task to the collection

**Parameters**

-   `task` **[Task](#task)** task to push

Returns **[Collection](#collection)** collection current collection

### remove

Removes task from the collection

**Parameters**

-   `task` **[Task](#task)** task to push

Returns **[Collection](#collection)** collection current collection

### run

Runs all tasks in the collection

### stop

Stops all tasks in the collection

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** stopped stopped status

### reset

Resets a stopped collection

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** reset reset status

### \_complete

Complete

Runs complete task

### \_recover

Recover

Runs recover task

**Parameters**

-   `error`  

### \_chainTask

Chain task

Attach the chain to the task

**Parameters**

-   `task` **[Task](#task)** task to chain

### \_unchainTask

Unchain task

Detach the chain from the task

**Parameters**

-   `task` **[Task](#task)** task to chain

### \_postTaskAdds

Probe post add actions

Try all post add triggers

### running

Gets the running status

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** running running status

### current

Gets the current task(s)

Returns **([Task](#task) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>)** task current task(s)

### passed

Gets the passed task(s)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>** task passed task(s)

### autoRun

Sets autoRun

Will autorun on push or unshift

**Parameters**

-   `value`  
-   `autoRun` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** auto runs on push or unshift

### autoRun

Gets autoRun

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** autoStart auto start on push or unshift

## Limiter

**Extends Parallel**

Limiter

Parallel with limit for max running tasks

**Parameters**

-   `limit` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** max running tasks
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

### constructor

Limiter constructor

**Parameters**

-   `limit` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** max running tasks
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

### \_runCondition

Returns the run condition

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** condition run condition

### \_taskComplete

Performs on every task complete

## Loop

**Extends Sequence**

Loop

Recurrent tasks

**Parameters**

-   `repeats` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of repeats. 0 for infinite
-   `repeat` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on repeat
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### constructor

Loop constructor

**Parameters**

-   `repeats` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of repeats. 0 for infinite
-   `repeat` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on repeat
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### \_complete

Complete

Runs complete task

### \_\_next

Gets next task from the loop

Returns **[Task](#task)** task next task

### passed

Gets the passed task(s)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>** task passed task(s)

## Parallel

**Extends Collection**

Parallel

Executes tasks all at once

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

### constructor

Parallel constructor

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

### run

Runs all tasks in the collection

### \_run

Runs a single task

**Parameters**

-   `task`  

### \_runCondition

Returns the run condition

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** condition run condition

### \_taskComplete

Performs on every task complete

### stop

Stops all tasks in the collection

**Parameters**

-   `skip` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force the stopped task to be skipped (optional, default `false`)

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** stopped stopped status

### reset

Resets a stopped collection

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** reset reset status

### current

Gets the current tasks

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>** task current tasks

### passed

Gets the passed task(s)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>** task passed task(s)

## Sequence

**Extends Collection**

Sequence

Executes tasks one by one

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### constructor

Sequence constructor

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### run

Runs all tasks in the collection

### stop

Stops all tasks in the collection

**Parameters**

-   `skip` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** force the stopped task to be skipped (optional, default `false`)

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** stopped stopped status

### reset

Resets a stopped collection

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** reset reset status

### \_next

Runs next in the sequence

### \_complete

Complete

Runs complete task

### \_recover

Recover

Runs recover task

**Parameters**

-   `error`  

### \_resetCurrent

Resets current

**Parameters**

-   `unchain`   (optional, default `false`)
-   `resetAfterComplete`   (optional, default `false`)

### \_\_next

Gets next task from the loop

Returns **[Task](#task)** task next task

### current

Gets the current task

Returns **[Task](#task)** task current task

### passed

Gets the passed task(s)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Task](#task)>** task passed task(s)

## AsyncMap

**Extends Map**

Map for AsyncTask

Maps the default ways to get a AsyncTask

### match

Match argument with a specific TriggerMap

**Parameters**

-   `args` **...any** 
-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `marker` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** 0 marks a async task

Returns **[Match](#match)** match

## Factory

Tasks and Collections Factory

It's a static class - do not instantiate with new

### \_CHAIN\_

Predefined name for a chain in attached task

**Parameters**

-   `_CHAIN_` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** predefined name

### maps

Maps collection for task matching

**Parameters**

-   `maps` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Map](#map)>** list of all maps

### attached

Attached variables

**Parameters**

-   `attached` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** collection of any attachments

### initialized

Initialized status

**Parameters**

-   `initialized` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** initialized status

### task

Gets a task by registered map match

**Parameters**

-   `args` **any** parameters depend on installed maps

Returns **[Task](#task)** task matching the parameters

### sequence

Gets a sequence

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

Returns **[Sequence](#sequence)** new sequence

### parallel

Gets a parallel

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

Returns **[Parallel](#parallel)** new sequence

### loop

Gets a loop

**Parameters**

-   `repeats` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** number of repeats, 0 for infinite
-   `repeat` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on repeat
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

Returns **[Loop](#loop)** new loop

### limiter

Gets a limiter

**Parameters**

-   `limit` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** max running tasks
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover
-   `completeOnFirst` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** completes on last or on first

Returns **[Limiter](#limiter)** new limiter

### initialize

Initializes the factory.

Initializes the factory. Will be called automatically on first task
or sequence call. Can be called explicitly with _force_

**Parameters**

-   `force` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** reinitialize if true (optional, default `false`)

### map

Adds new map for tasks matching

**Parameters**

-   `map` **[Map](#map)** map for tasks matching

### unmap

Removes map from tasks matching

**Parameters**

-   `map` **[Map](#map)** map to remove from tasks matching

### unmapAll

Removes all maps

### attach

Attaches variable to the factory

Useful to store your collections and access them
later on from anywhere. Or store anything you want
in this predefined place

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable
-   `value` **any** variable value

### detach

Detaches variable by name

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

### get

Gets variable by name

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

Returns **any** variable value

## Map

Map for tasks

Map is used to match parameters with tasks. Every map shall
match and return Match class unique for parameters. In case
of Match overlapping the one with bigger priority will be
selected.

This class is the base for all Map classes. Cannot be used
directly. Extend to use.

### match

Match argument with a specific tasks

**Parameters**

-   `args` **...any** 

Returns **[Match](#match)** match

## Match

Match for a Map

Match contains the instance of the Task and a
percentage from 0 to 1. In cases of overlapping
of Matches the one with bigger percentage will be
used

**Parameters**

-   `instance` **[Task](#task)** any Task instance
-   `percentage` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** from 0 to 1

### constructor

Match constructor

**Parameters**

-   `instance` **[Task](#task)** any Task instance
-   `percentage` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** from 0 to 1

### percentage

Percentage setter

**Parameters**

-   `value` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** from 0 to 1

### percentage

Percentage getter

Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** percentage value from 0 to 1

## PromiseMap

**Extends Map**

Map for PromiseTask

Maps the default ways to get a PromiseTask

### match

Match argument with a specific PromiseMap

**Parameters**

-   `args` **...any** 
-   `promise` **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise to wait for
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

Returns **[Match](#match)** match

## RawMap

**Extends Map**

Raw map for Task

Maps the default ways to get a Task

### match

Match argument with a specific Task

**Parameters**

-   `args` **...any** 
-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

Returns **[Match](#match)** match

## TimeoutMap

**Extends Map**

Map for TimeoutTasks

Maps the default ways to get a TimeoutTask

### match

Match argument with a specific TimeoutTask

**Parameters**

-   `args` **...any** 
-   `timeout` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** timeout in ms
-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

Returns **[Match](#match)** match

## TriggerMap

**Extends Map**

Map for TriggerTask

Maps the default ways to get a TriggerTask

### match

Match argument with a specific TriggerTask

**Parameters**

-   `args` **...any** 
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `marker` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false marks a trigger task

Returns **[Match](#match)** match

## AsyncTask

**Extends Task**

AsyncTask

Executes run and does not complete automatically.
Need manual call of complete() method.
Useful for triggers.

Similar with TriggerTask, but with full set of run, complete and recover.
In run method first parameter will be complete callback, second self and
...args to follow. Does not care what run returns.

**Parameters**

-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

**Examples**

```javascript
run = (complete, self, ...args) => { complete(); }
```

### constructor

AsyncTask constructor

**Parameters**

-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### run

Runs a task

Executes the run function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

## Injector

Injector. Internal class

Injects functions into objects. Used internally.
Not intended to be used on it's own.

### afterComplete

Appends a function after complete and remembers the original

**Parameters**

-   `task` **[Task](#task)** task to be modified
-   `callback` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called after complete
-   `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** map for the original callback

Returns **[Task](#task)** task modified task

### resetAfterComplete

Resets the complete method to it's original state

**Parameters**

-   `task` **[Task](#task)** task to be modified
-   `key` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** map for the original callback

Returns **[Task](#task)** task modified task

### addChainGetter

Adds a method called chain to get Factory._CHAIN_

Shortcut for task.get(Factory._CHAIN_)

**Parameters**

-   `task` **[Task](#task)** task to be modified

Returns **[Task](#task)** task modified task

### removeChainGetter

Remove a method called chain to get Factory._CHAIN_

**Parameters**

-   `task` **[Task](#task)** task to be modified

Returns **[Task](#task)** task modified task

## PromiseTask

**Extends Task**

PromiseTask

Takes a Promise and waits for it to complete.
Will attack to finally and complete.
Useful for triggers.

Similar with TriggerTask, but with set of complete and recover.

**Parameters**

-   `promise` **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise instance to wait for
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### constructor

PromiseTask constructor

**Parameters**

-   `promise` **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise instance to wait for
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### run

Runs a task

Checks if promise already resolved. If not does nothing.

**Parameters**

-   `args` **any** any arguments

### \_isPromise

Checks if instance is Promise

We do not want promises as a dependency - as it's conditionally used.
The checks for promise will be a bit loose - just checking for finally
and assuming it's a Promise.

**Parameters**

-   `promise` **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise instance

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### \_setPromise

Sets promise and attaches to finally

**Parameters**

-   `promise` **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)** promise instance

### \_promiseFinally

Handles promise finally resolved

## Task

Task

Basic task with run, complete and recover

run function can return nothing(undefined) and it will
call complete instantly. if run returns anything it will
NOT call complete automatically and it's up to you to
trigger complete.

**Parameters**

-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

**Examples**

```javascript
run = () => { console.log('next thing is complete'); }
```

```javascript
run = (self) => {
  console.log('will manually call complete()');
  // some logic to call self.complete() later
  // or call complete() from outside to make a trigger waiter
  return 1; // or whatever you want but undefined
}
```

### constructor

Task constructor

**Parameters**

-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### attach

Attaches variable to the task

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable
-   `value` **any** variable value

### detach

Detaches variable by name

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

### get

Gets variable by name

**Parameters**

-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** accessor for the variable

Returns **any** variable value

### run

Runs a task

Executes the run function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

### complete

Completes a task

Executes the complete function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

### recover

Recovers a task

Executes the recover function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

### stop

Stops a task

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** success

### restart

Restarts a task

If stopped will start it
If running will respect stop()

**Parameters**

-   `args` **...any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** success

### running

Gets the running status

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** running

### done

Gets the done status

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** done

### failed

Gets the failed status

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** failed

### exceptions

Gets the exceptions if any

Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** exceptions

## TimeoutTask

**Extends Task**

TimeoutTask

Timeout task with run, complete and recover.
Executes after initial timeout

**Parameters**

-   `timeout` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** wait before run
-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### constructor

TimeoutTask constructor

**Parameters**

-   `timeout` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** wait before run
-   `run` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on run
-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete
-   `recover` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on recover

### run

Runs a task

Executes the run function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

### complete

Completes a task

Executes the complete function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments

### stop

Stops a task

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** success

## TriggerTask

**Extends Task**

TriggerTask

Trigger task with complete.
Executes run and does not complete automatically.
Need manual call of complete() method.
Useful for triggers.

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete

### constructor

TriggerTask constructor

**Parameters**

-   `complete` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** function to be called on complete

### run

Runs a task

Executes the run function if defined. All arguments will be
passed to it.

**Parameters**

-   `args` **any** any arguments
