API. Events

new Events()

Methods

off(eventName)

Removes the subscriptions with a given event name.

Parameters:
NameTypeDescription
eventNamestring

Name of the event.

on(eventName, callback)

Subscribes to controller resource with a given event name

Parameters:
NameTypeDescription
eventNamestring

Name of the event

callbackfunction

Function to be called when event is triggered

trigger(eventName, data)

Triggers all the callback functions that have subscribed to an event.

Parameters:
NameTypeDefaultDescription
eventNamestring

Name of the event to be triggered

dataanynull

Data passed to the callback as input parameter