# Async

## async. Async

#### new Async()

Source:
  - constructors/async.js, line 18

### Methods

#### done(cb)

Source:
  - constructors/async.js, line 172

register a callback to be called when processing is done

##### Parameters:

Name | Type | Description
--- | --- | ---
`cb` | function |

#### errors() → {Array.<Error>}

Source:
  - constructors/async.js, line 148

return all errors found in responses

##### Returns:

Type
  Array.<Error>

#### flush()

Source:
  - constructors/async.js, line 109

reset operation processing

#### index() → {string}

Source:
  - constructors/async.js, line 33

return unique index identifier for an operation

##### Returns:

Type
  string

#### processing() → {number}

Source:
  - constructors/async.js, line 122

return how many operations are processing right now

##### Returns:

Type
  number

#### receive(id, args) → {boolean}

Source:
  - constructors/async.js, line 47

method used for return result for an operation, returns `true` if value was accepted. if operation already obtained a value then value is not accepted and it returns `false`

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | string | obtained from `async.Async#index`
`args` | any |

##### Returns:

Type
  boolean

#### reserve() → {string}

Source:
  - constructors/async.js, line 81

require to reserve index `async.Async#index` for an additional operation

##### Returns:

Type
  string

#### responses(returnUnknownResponsesopt) → {Array.<Array.<any>>}

Source:
  - constructors/async.js, line 132

return operations' responses

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`returnUnknownResponses` | boolean | <optional> | `false` |

##### Returns:

Type
  Array.<Array.<any>>

#### run(func, args, context) → {string}

Source:
  - constructors/async.js, line 92

require to run an operation

##### Parameters:

Name | Type | Description
--- | --- | ---
`func` | function | function that should be executed
`args` | Array.<any> |
`context` | object |

##### Returns:

Type
  string

#### wait()

Source:
  - constructors/async.js, line 72

require to wait an additional operation

### Type Definitions

#### Operation

Source:
  - constructors/async.js, line 190

##### Properties:

Name | Type | Description
--- | --- | ---
`0` | async.Async.OperationCallback |
`1` | async.Async.OperationArgs |
`2` | async.Async.OperationContext |
`3` | async.Async.OperationCallbackIndex |

##### Type:

- Array

#### Operation

Source:
  - constructors/async.js, line 199

##### Type:

- Array.<Array.<function(), Array.<any>, object, number>>

#### OperationArgs

Source:
  - constructors/async.js, line 210

list if arguments passed to `OperationCallback`.

##### Type:

- Array.<any>

#### OperationCallback()

Source:
  - constructors/async.js, line 204

a function that represents the operation itself, it have as argument `next` callback, by default it is first.

#### OperationCallbackIndex

Source:
  - constructors/async.js, line 222

index of `next()` callback in list of `OperationCallback`'s arguments. Default value is `0`.

##### Type:

- number

#### OperationContext

Source:
  - constructors/async.js, line 216

context that should be used in `OperationCallback`. Default value is `{}`.

##### Type:

- object

#### Operations

Source:
  - constructors/async.js, line 228

##### Type:

- Array.<async.Async.Operation>