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

disable() can not work #11

Open
Namide opened this issue Oct 30, 2019 · 0 comments · May be fixed by #23
Open

disable() can not work #11

Namide opened this issue Oct 30, 2019 · 0 comments · May be fixed by #23

Comments

@Namide
Copy link

Namide commented Oct 30, 2019

This listeners can not be removed.

this.target.addEventListener('touchstart', this.recordTouchStartValues.bind(this));
this.target.addEventListener('touchend', this.detectSwipeDirection.bind(this));

Because this.recordTouchStartValues.bind(this) !== this.recordTouchStartValues.bind(this) (the pointer is new every time bind is called).

So the function disable() will not remove the listeners.

Please store this.xxx.bind(this) in variables and add and remove listeners with the same variables.

@rquanx rquanx linked a pull request Sep 21, 2022 that will close this issue
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