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 eventsString | Array The event or events to listen to.
callbackfunction The function to invoke when any of the events are invoked.
contextObject optional The value of
thiswhen the callback is invoked. If not specified, the reference of the object this function exists on will bethis.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 eventsString | Array The event or events to listen to.
callbackfunction The function to invoke when any of the events are invoked.
contextObject optional The value of
thiswhen the callback is invoked. If not specified, the reference of the object this function exists on will bethis.Returns:
Type Description function - A function to invoke to stop listening to all of the events given.