Salesforce Interview Questions & Answers Book is now available!

Grab Now

Aura

Application Events in Aura Components

A few things to understand related to Application Events in Aura Components.

By Teja, ex-Salesforce engineer · Updated January 23, 2020 · 1 min read

Events play a key role when it comes to transfer of data between components.

We will be looking at understanding a few technicalities related to Application Events in Aura Components.

In case you are interested in getting a hang of the steps involved in implementing events before we talk more about Application Events in specific, check the graphic below.

Now if you look at step #2, we need to implement this step only when we work with Component Events and we can skip it when we work with Application Events in Aura Components.

Which is this ..

<aura:registerEvent name="appEvent" type="c:appEvent" />

Mostly because, Application events are available for the whole application and you don't have to register them to a particular component.

However, that's not the case with Component Events.   We need to register an event with a component and it's mandatory.

That's how when the event is fired from the child component, the parent component check's if its registered with the child. If it's registered, it listens else fails silently.

Let's say Component C register the events and fires it. Assume Component B and Component A has aura handler to listen to the event.

Component B listens to the event since its child has registered the event and Component A check's if its child has the event registered. Component B is not registering the event so it's not going to invoke event listeners.

Learn it by building it

Every course, every code repository, the discussion group and certificates of completion — one subscription.

Keep me in the loop!

Email me when a new episode is published (promise, I will not spam you)

You're signing up to receive emails from Salesforce Casts