Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeListener not removing listeners #191

Closed
harmonherring opened this issue Nov 12, 2024 · 0 comments · Fixed by #192
Closed

removeListener not removing listeners #191

harmonherring opened this issue Nov 12, 2024 · 0 comments · Fixed by #192

Comments

@harmonherring
Copy link
Contributor

harmonherring commented Nov 12, 2024

This is the code being referenced in the background component

According to Overwolf docs

The callback should be the same function that was passed to addListener() so this won’t work with anonymous function

This usage in the background function uses anonymous functions, and so the listeners aren't being removed. Since the background window is mounted and unmounted several times this results in several identical listeners being registered, a situation that's also called out in the docs

We’ve seen situations where apps would register addListener multiple times for the same event – this caused the event to be triggered multiple times and causes unexpected bugs and memory leaks. Please pay attention when registering to events and prevent it.

AlbericoD added a commit that referenced this issue Nov 26, 2024
Fixes #191 - Use named listener functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant