Activity Forums Salesforce® Discussions Type of events in Salesforce Lightning component?

  • Anjali

    Member
    September 17, 2018 at 2:00 pm

    Hi Anurag,

    We have 2 types of Events in Salesforce Lightning component-

    Application Event-All components inside the Application will get notified when Application event fires.
    Component Event -Component event  will notify to only those component which are in hierarchy.

  • Parul

    Member
    September 17, 2018 at 2:10 pm

    All we know, that we have 2 types of Events

    1. Application Event: Application events follow a traditional publish-subscribe model. An application event is fired from an instance of a component. All components that provide a handler for the event are notified.
    2. Component Event: A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.

    All components inside the Application will get notified when Application event fires. where as Component event only those component will notify which are in hierarchy.

     

    Thanks.

  • shariq

    Member
    September 18, 2018 at 8:06 am

    Hi,

    Event :

    An event can be something the browser does, or something a user does.

    Lightning framework uses event driven programming. Handlers are written for interface events and they handles the events as they fire. In Lightning framework events are triggered from client side JavaScript controller actions. The attributes in an event could be set before the event gets trigerred and read only when the event is handled.

    In Lightning framework events are declared by the aura:event tag in a .evt resource. Events can be of two types :

    Component Events:A component event can be triggered from an instance of a component and can be handled by the component that triggered it or by any other component in the hierarchy that recieve the event.
    Application Events:An application event is fired by an instance of a component and all the components that provide handler for the event are notified.
    Steps to communicate between two lightning components using events:
    Create an event.
    Create two lightning component : Child component and parent component.
    Register the event in child component and fired the event in child component JavaScript controller action.
    Handle the event in parent component.

    Thanks

  • Prachi

    Member
    September 20, 2018 at 5:21 am

    hi,

    Component Events:A component event can be triggered from an instance of a component and can be handled by the component that triggered it or by any other component in the hierarchy that recieve the event.
    Application Events:An application event is fired by an instance of a component and all the components that provide handler for the event are notified.

    Thanks

Log In to reply.

Popular Salesforce Blogs