You can add custom events to the components dynamically by using the addEventHandler() method in the component object.
The syntax for a custom event is as follows:
addEventHandler(String event, Function handler, String phase, String includeFacets)
The following provides a description for each of the parameters of the addEventHandler component method:
- The first argument is the name of the event that triggers the handler. The <aura:registerEvent> tag in a component's markup declares the event that the component fires.