# AsyncEventEmitter

Event emitter class that provides an async `emit` function, useful for when one needs to `await` the event and all of its listeners.

## Constructor

#### new AsyncEventEmitter()

Source:
  - async_event_emitter.js, line 13

### Methods

#### (async) emit(eventName, …args) → {Promise}

Source:
  - async_event_emitter.js, line 124

Emit an event; can be await'ed, and will resolve after all handlers have been called

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`eventName` | string |  | event name to emit
`args` | any | <repeatable> | arguments to pass to listeners

##### Returns:

p - resolves when all listeners complete

Type
  Promise

#### off(cb)

Source:
  - async_event_emitter.js, line 60

Remove an event handler by event name

##### Parameters:

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

#### on(matcher, cb)

Source:
  - async_event_emitter.js, line 88

Bind an event handler

##### Parameters:

Name | Type | Description
--- | --- | ---
`matcher` | string | RegExp | regular expression or string to match with
`cb` | function | callback

#### onAll(cb) → {Promise}

Source:
  - async_event_emitter.js, line 102

Bind an event handler for all event types

##### Parameters:

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

##### Returns:

p - resolves when all listeners complete

Type
  Promise

#### onAllOnce(cb) → {Promise}

Source:
  - async_event_emitter.js, line 112

Bind an event handler for all event types that only fires once

##### Parameters:

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

##### Returns:

p - resolves when all listeners complete

Type
  Promise

#### once(matcher, cb)

Source:
  - async_event_emitter.js, line 74

Bind an event handler that should only fire once

##### Parameters:

Name | Type | Description
--- | --- | ---
`matcher` | string | RegExp | regular expression or string to match with
`cb` | function | callback

#### removeAllListeners(matcher, negativeMatch)

Source:
  - async_event_emitter.js, line 25

Removes all listeners, only those for the specified event name, or those matching/not matching a regular expression

##### Parameters:

Name | Type | Description
--- | --- | ---
`matcher` | string | RegExp | regular expression or string to match with
`negativeMatch` | boolean | if true, events not matching are deleted