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

Potential memory leaks with event listeners #452

Open
k-ivan opened this issue Nov 30, 2023 · 3 comments
Open

Potential memory leaks with event listeners #452

k-ivan opened this issue Nov 30, 2023 · 3 comments

Comments

@k-ivan
Copy link

k-ivan commented Nov 30, 2023

Thanks for the great plugin!

It seems to me that in the method for removing event handlers there is not enough removal for the keydown event.
https://github.com/kamranahmedse/driver.js/blob/master/src/events.ts#L118

@k-ivan k-ivan changed the title Removing keydown listener when destroyed Potential memory leaks with event listeners Dec 1, 2023
@k-ivan
Copy link
Author

k-ivan commented Dec 1, 2023

And it’s not enough to delete events in this place, especially important for SPA project.

document.addEventListener("pointerdown", listenerWrapper, useCapture);
-

All these events, each time the method drive() launched, multiply the number of handlers.

@k-ivan
Copy link
Author

k-ivan commented Dec 1, 2023

Maybe I'm missing something, but on the screen there are 3 states after calling the method (check with getEventListeners(document))

  1. before the plugin works
  2. first launch driver
  3. re-launch driver(or prev|next click)

image

@k-ivan
Copy link
Author

k-ivan commented Jan 10, 2024

Hello @kamranahmedse !
I wanted to ask if you are still maintaining this wonderful plugin, could you consider my PR on this issue?

I would really like to solve this problem.

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

No branches or pull requests

1 participant