Events Fundamentals In Lightning Aura Components
Event-driven programming is used in many languages and frameworks, such as JavaScript and Java Swing. The idea is that you write handlers that respond to events as they occur.
A component registers that it may fire an event in its markup. Events are fired from JavaScript controller actions that are typically triggered by a user interacting with the user interface.
There are two types of events in the framework:
- Component events are handled by the component itself or a component that instantiates or contains the component.
- Application events are handled by all components that are listening to the event. These events are essentially a traditional publish-subscribe model.
You should be also aware of different phases of DOM Events propagation which are as follows:
- Capturing phase: the event goes down to the element.
- Target phase: the event reached the target element.
- Bubbling phase: the event bubbles up from the element.
Please get yourself familiar with these phases of DOM Events by reading a beautiful post over here – https://javascript.info/bubbling-and-capturing
In the next part, we would be learning about the Component Events & Application Events in great detail.
Thank you for visiting SalesforceBlue.com
If you have any queries feel free to write down a comment below 🙂