Application events
Application events are fired from a component, and any other component can handle the event. The event propagation is very similar to browser events; both have capture and bubble phases, as we discussed in the previous section. However, there are some differences in the rules, which we will cover later in this section.
Apart from the capture and bubble phases, there is a default phase. The default phase is useful for handling application events that affect components in different sub-trees of your app. Note that the default phase does not have propagation rules to follow in a hierarchy, such as a capture and bubble phase.
Note
The framework executes the default phase from the root node unless preventDefault()
was called in the capture or bubble phases.
Let's look at a few code snippets, to understand how you can fire the application events, and how componentscan listen to the events.
Creating application events
To create an application event, you need to define the a.evt
file...