Types of events in Aura components / Lightning Web Components

In Aura components, there are two types of events, as explained below:

  • Component- This type of event is fired from an instance of a component and can be handled only by the component that fired it or a component in the containment hierarchy.

  • Application- This type of event is fired from an instance of a component and can be handled by any component which provides a handler to listen to it.

In Lightning Web Components, there are events with the same behaviour as component and application events but with a different name and way of implementation, as explained below:

  • Dispatch Event- This is similar to component events. It requires you to create an event using CustomEvent() and fire using EventTarget.dispatchEvent().

  • Lightning Message Service or PubSub Model- is similar to application events where the components are not in the same DOM tree.