# Mixin: Events

## Events

Provides event emitter functionality including the methods: on, off, once, emit, deferEmit.

Source:
  - Mixin.Events.js, line 5

### Methods

- (static) deferEmit(eventName, dataopt)
- (static) emit(event, data) → {*}
- (static) off(event, id)
- (static) off(event, id, listener)
- (static) off(event, listener) → {*}
- (static) off(event) → {*}
- (static) on(event, id, listener) → {*}
- (static) on(event, listener) → {*}
- (static) once(event, id, listener) → {*}
- (static) once(event, listener) → {*}

#### (static) deferEmit(eventName, dataopt)

Queues an event to be fired. This has automatic de-bouncing so that any events of the same type that occur within 100 milliseconds of a previous one will all be wrapped into a single emit rather than emitting tons of events for lots of chained inserts etc. Only the data from the last de-bounced event will be emitted.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`eventName` | String |  | The name of the event to emit.
`data` | * | <optional> | Optional data to emit with the event.

Source:
  - Mixin.Events.js, line 305

#### (static) emit(event, data) → {*}

Emit an event with data.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The event to emit.
`data` | * | Data to emit with the event.

Source:
  - Mixin.Events.js, line 213

##### Returns:

Type
  *

#### (static) off(event, id)

Cancels all listeners for an event based on the passed event name and id.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The event name to cancel listeners for.
`id` | * | The ID to cancel all listeners for.

Source:
  - Mixin.Events.js, line 189

#### (static) off(event, id, listener)

Cancels an event listener based on an event name, id and listener function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The event to cancel listener for.
`id` | String | The ID of the event to cancel listening for.
`listener` | function | The event listener function used in the on() or once() call to cancel.

Source:
  - Mixin.Events.js, line 160

#### (static) off(event, listener) → {*}

Cancels the event listener for the passed event and listener function.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The event to cancel listener for.
`listener` | function | The event listener function used in the on() or once() call to cancel.

Source:
  - Mixin.Events.js, line 121

##### Returns:

Type
  *

#### (static) off(event) → {*}

Cancels all event listeners for the passed event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The name of the event.

Source:
  - Mixin.Events.js, line 97

##### Returns:

Type
  *

#### (static) on(event, id, listener) → {*}

Attach an event listener to the passed event only if the passed id matches the document id for the event being fired.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The name of the event to listen for.
`id` | * | The document id to match against.
`listener` | function | The method to call when the event is fired.

Source:
  - Mixin.Events.js, line 29

##### Returns:

Type
  *

#### (static) on(event, listener) → {*}

Attach an event listener to the passed event.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The name of the event to listen for.
`listener` | function | The method to call when the event is fired.

Source:
  - Mixin.Events.js, line 12

##### Returns:

Type
  *

#### (static) once(event, id, listener) → {*}

Attach an event listener to the passed event that will be called only once.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The name of the event to listen for.
`id` | String | The document id to match against.
`listener` | function | The method to call when the event is fired.

Source:
  - Mixin.Events.js, line 72

##### Returns:

Type
  *

#### (static) once(event, listener) → {*}

Attach an event listener to the passed event that will be called only once.

##### Parameters:

Name | Type | Description
--- | --- | ---
`event` | String | The name of the event to listen for.
`listener` | function | The method to call when the event is fired.

Source:
  - Mixin.Events.js, line 50

##### Returns:

Type
  *