DEV Community

loading...

Discussion on: Refactor davidwalsh's debounce function using ES6 arrow and more

Collapse
thexsdev profile image
thexs-dev

I will be using your improved ES6 debounce version from now on ... Thanks!

On a side note
There is a less popular but quite useful function async-debounce from Julian Gruber that

  • not just run after no calls to it have happened for x milliseconds
  • but also skips calls while the function is currently running to avoid concurrency
  • like when the debounced function calls an Api that take some time to respond (e.g. querying or heavy filtering responding to user's keystrokes)

Is there a ES6 approach to that or another way of achieving that same result?