|
Answer» The following table lists the differences between component events and application events : | Component Event | Application Event |
|---|
| The component that instantiates or contains the component can HANDLE component events. | Any component with an event HANDLER is ABLE to handle application events. These events follow the usual publish-subscribe format. | | Only child COMPONENTS can register component events, which are then handled by the parent component. | The application event can be utilised anywhere in the app. | | For a component event, we utilise the aura:event tag's type="COMPONENT" property. | For an application event, we utilise the aura:event tag's type="APPLICATION" property. | | When processing component events, the name property in aura:handler must be specified. The name attribute in aura:handler must match the name attribute in the aura:registerEvent tag in the event-firing Child Component. | There is no need to give the name attribute in aura:handler when handling application events. | | In JavaScript, we USE cmp.getEvent("eventName") to get an instance of the Component type event. | In JavaScript, we acquire an instance of the Application type event by calling $A.get("e.myNamespace:myAppEvent"). |
|