# How does eventlisteners work?

**URL:** <https://devforum.zoom.us/t/how-does-eventlisteners-work/82082>\
**Category:** Zoom Apps\
**Created:** [January 25, 2023, 7:36am UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082 "2023-01-25T07:36:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunika.makker](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kunika.makker](https://devforum.zoom.us/u/kunika.makker)\
**Post date:** [January 25, 2023, 7:36am UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082/1 "2023-01-25T07:36:51Z")

</div>

We need the host to get the details of the new users in our app, whenever a new user joins the call irrespective that person is using the app or not.

I tried

zoomSdk.addEventListener(‘onMyUserContextChange’, (event) =\> {  
console.log(‘onMyUserContextChange’, event);  
});

this code inside ngOnChanges but didn’t work.

thanks in advance

---

<div class="post-metadata">

**Author:** ![narmadaravali](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/narmadaravali/32/39496_2.png) [@narmadaravali](https://devforum.zoom.us/u/narmadaravali)\
**Post date:** [January 30, 2023, 7:03pm UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082/2 "2023-01-30T19:03:08Z")

</div>

use `onParticipantChange` event to know when a user joins or leaves a meeting. [https://marketplace.zoom.us/docs/zoom-apps/js-sdk/reference/#onParticipantChange](https://marketplace.zoom.us/docs/zoom-apps/js-sdk/reference/#onParticipantChange)

---

<div class="post-metadata">

**Author:** ![kunika.makker](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kunika.makker](https://devforum.zoom.us/u/kunika.makker)\
**Post date:** [January 31, 2023, 6:53am UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082/3 "2023-01-31T06:53:24Z")

</div>

> [@narmadaravali](#):
>
> ow when a user joins or leaves a me

I tried using `onParticipantChange` as well

`zoomSdk.addEventListener('onParticipantChange', (event) => { console.log('onParticipantChange',event) });`

like this inside `ngOnChanges` but still didn’t work.

---

<div class="post-metadata">

**Author:** ![narmadaravali](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/narmadaravali/32/39496_2.png) [@narmadaravali](https://devforum.zoom.us/u/narmadaravali)\
**Post date:** [January 31, 2023, 6:37pm UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082/4 "2023-01-31T18:37:12Z")

</div>

Yes, that is the way to add event listener. Add the event listener when component loads.

---

<div class="post-metadata">

**Author:** ![kunika.makker](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kunika.makker](https://devforum.zoom.us/u/kunika.makker)\
**Post date:** [February 1, 2023, 10:34am UTC](https://devforum.zoom.us/t/how-does-eventlisteners-work/82082/5 "2023-02-01T10:34:25Z")

</div>

Thank you so much. It worked for me, though the issue was not with the code. I missed adding this event in the app configuration.
