Class: Eventful

Rekord. Eventful

new Rekord.Eventful()

A mixin which adds on, once, after, and trigger functions to another object.

See:

Methods

on(events, callback, context){function}

Listens for every occurrence of the given events and invokes the callback each time any of them are triggered.

Name Type Description
events String | Array

The event or events to listen to.

callback function

The function to invoke when any of the events are invoked.

context Object optional

The value of this when the callback is invoked. If not specified, the reference of the object this function exists on will be this.

Returns:
Type Description
function - A function to invoke to stop listening to all of the events given.

once(events, callback, context){function}

Listens for the first of the given events to be triggered and invokes the callback once.

Name Type Description
events String | Array

The event or events to listen to.

callback function

The function to invoke when any of the events are invoked.

context Object optional

The value of this when the callback is invoked. If not specified, the reference of the object this function exists on will be this.

Returns:
Type Description
function - A function to invoke to stop listening to all of the events given.