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

allow debounce to trigger on leading (and trailing) edge #408

Open
mkresse opened this issue May 22, 2024 · 3 comments · Fixed by radashi-org/radashi#128
Open

allow debounce to trigger on leading (and trailing) edge #408

mkresse opened this issue May 22, 2024 · 3 comments · Fixed by radashi-org/radashi#128

Comments

@mkresse
Copy link

mkresse commented May 22, 2024

Hello,

I would like to propose a feature enhancement for the debounce() function. Currently, debounce() only triggers on the trailing edge. However, in certain use cases, it would be beneficial to have the option to also trigger on the leading edge. This enhancement could significantly improve the perceived performance of an application using this function, as on the start of a series of user actions, an immediate feedback can be given.

The expected behavior would be similar to the debounce implementation in lodash, where both the leading and trailing options are set to true (see "Note" on documentation). This would provide more flexibility and control over the function's behavior, allowing developers to better tailor the function to their specific needs.

Thank you for considering this feature request. I believe this enhancement would be a valuable addition to the radash library.

Best regards.

@aleclarson
Copy link

Looks like @LynnSha1ng has implemented this in #387. We'd appreciate this improvement over at radashi-org/radashi if anyone wants to transfer it over. :)

@crishoj
Copy link

crishoj commented Jul 21, 2024

@aleclarson I took a stab at this, although with falling edge option for throttle instead:

@lake2
Copy link

lake2 commented Jul 31, 2024

same issue +1

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.

4 participants