I have a LWC component and I am using pubsub to fire events across other LWC components. I have a use case where I need to fire the events in sequence.

Here I want to fire 'event2' event only after 'event1' is completed

fireEvent(this.pageRef, 'event1')
fireEvent(this.pageRef, 'event2');

I tried using the below promise syntax also, but it's erroring out.

fireEvent(this.pageRef, 'event1').then(() => {
                        fireEvent(this.pageRef, 'event2');

Is there any way to fire the pubsub events sequentially?

1 Answer 1


you could call the second event from within the callback method that runs after the first event is fired, if you need information from the lwc that is calling the first event in the second event you could pass the values as a detail object associated to the event

  • Awesome, it worked. I am calling event 2 from the callback function of event 1.
    – sfdc07
    Commented Dec 17, 2020 at 19:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .