1.

Explain how an application event propagates in the context of Salesforce Lighting.

Answer»

For the propagation of application events, the framework offers the CAPTURE, bubble, and default phases. The capture and bubble phases are similar to DOM handling patterns in that they allow interested components to engage with an EVENT and perhaps impact later handler behaviour. The framework's INITIAL handling behaviour is preserved in the default phase. The source component is the component that fires an event. The framework enables you to manage the event in stages. These phases provide you with the FREEDOM to decide how to handle the event in your application.

The phases are as follows:

  • Capture: This phase is the same as that of the component event.
  • Bubble: This phase is the same as that of the component event.
  • Default: From the root node through its subtree, event handlers are called in a non-deterministic order. The default phase does not follow the same component hierarchy propagation principles as the capture and bubble phases. Application events that affect components in SEPARATE sub-trees of your app can be handled using the default phase.
    The root node defaults to the application root if the event propagation was not stopped in a prior phase. The root node is set to the component whose handler invoked the event.stopPropagation() if it was halted in a previous phase.


Discussion

No Comment Found