Mixin: Events

Events

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

Methods

(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:

(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:
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:

(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:

(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:
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:
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:
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:
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:
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:
Returns:
Type
*