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

debounce function #164

Closed
SingAurora opened this issue Aug 10, 2024 · 3 comments
Closed

debounce function #164

SingAurora opened this issue Aug 10, 2024 · 3 comments

Comments

@SingAurora
Copy link

The debounce function is run at the end of the time window, there is no way to start running in the time window.

@MarlonPassos-git
Copy link
Contributor

We have an open PR (#128) that addresses this by adding a leading option to the debounce function.

@MarlonPassos-git
Copy link
Contributor

@SingAurora The PR was merged. Here's an example of how to use the leading option to trigger the function immediately on the first call:

const genericFunction = () => {
  console.log("This function is called immediately when leading is true.");
};

const debouncedFunc = _.debounce({ delay: 5000, leading: true }, genericFunction);

@SingAurora
Copy link
Author

SingAurora commented Aug 15, 2024 via email

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

2 participants