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

Fix debounce cancel #105

Open
aleclarson opened this issue Jul 12, 2024 · 0 comments · May be fixed by #107
Open

Fix debounce cancel #105

aleclarson opened this issue Jul 12, 2024 · 0 comments · May be fixed by #107
Labels
BREAKING CHANGE Not backwards compatible PR in review A pull request has been opened for this issue.

Comments

@aleclarson
Copy link
Member

As mentioned in sodiray/radash#362, the cancel method should clear the timeout rather than cause the pending timeout to do nothing. The expected behavior is that calling the debounced function after cancelling it will result in an eventual invocation.

const fn = debounce({ delay: 100 }, () => console.log('hi'))

fn()
fn()
fn.cancel()
fn()
fn() // Logs "hi" once 100 ms after this call.

/cc @QTimort and @MarlonPassos-git as you both participated in sodiray/radash#362

@aleclarson aleclarson added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jul 12, 2024
@aleclarson aleclarson linked a pull request Jul 13, 2024 that will close this issue
2 tasks
@aleclarson aleclarson added BREAKING CHANGE Not backwards compatible PR in review A pull request has been opened for this issue. and removed bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING CHANGE Not backwards compatible PR in review A pull request has been opened for this issue.
Projects
None yet
1 participant