# How do you stop listening to events when the panel/plugin is closed?

**URL:** <https://forums.creativeclouddeveloper.com/t/how-do-you-stop-listening-to-events-when-the-panel-plugin-is-closed/5042>\
**Category:** UXP Plugin API\
**Created:** [August 2, 2022, 9:16am UTC](https://forums.creativeclouddeveloper.com/t/how-do-you-stop-listening-to-events-when-the-panel-plugin-is-closed/5042 "2022-08-02T09:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paintpaul](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/paintpaul/32/2283_2.png) [@Paintpaul](https://forums.creativeclouddeveloper.com/u/Paintpaul)\
**Post date:** [August 2, 2022, 9:16am UTC](https://forums.creativeclouddeveloper.com/t/how-do-you-stop-listening-to-events-when-the-panel-plugin-is-closed/5042/1 "2022-08-02T09:16:49Z")

</div>

I know there are some lifecycle hooks using entrypoints.setup, but most of them still don’t work as needed… Now, I have some event listeners that call functions that I don’t want to have around all the time, when the plugin and panel is closed. How do you check for closing and reopening?

---

<div class="post-metadata">

**Author:** ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)\
**Post date:** [August 2, 2022, 5:36pm UTC](https://forums.creativeclouddeveloper.com/t/how-do-you-stop-listening-to-events-when-the-panel-plugin-is-closed/5042/2 "2022-08-02T17:36:33Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/3/3d4c02cf5b150b3903efa3019a4803334a9992f9.png)  
You have to use listener and listen for specific event names  
Note: some of those commands are my own.

---

<div class="post-metadata">

**Author:** ![Paintpaul](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/paintpaul/32/2283_2.png) [@Paintpaul](https://forums.creativeclouddeveloper.com/u/Paintpaul)\
**Post date:** [August 3, 2022, 7:53am UTC](https://forums.creativeclouddeveloper.com/t/how-do-you-stop-listening-to-events-when-the-panel-plugin-is-closed/5042/3 "2022-08-03T07:53:39Z")

</div>

Thank you very much! Exactly what I was looking for 🙂
