DEV Community

taiseen
taiseen

Posted on

Debouncing & Throttling

What is debouncing?

It is limit the execution of a function call & waits for a certain amount of time, before running it again.

So, debouncing allows us to - discard all the same functionCall's(), but except just 1 functionCall() from them, after a certain amount of time.

So, debouncing guarantees us - that a function will be run after "x" amount of time, just once...


What is throttling?

It is a limit the execution of function call when this function call triggers continuously due to user actions.

So, throttling allows us to - pass all the same functionCall's(), but pass just 1 functionCall() - one by one from them, under a certain amount of time.

So, throttle guarantees us - that a function will be run after "x" amount of time, one by one...


For both example - that time can be 500 or 800 milliseconds, as per your requirement.

Top comments (2)

Collapse
 
naucode profile image
Al - Naucode

Great article, you got my follow, keep writing!

Collapse
 
taiseen profile image
taiseen

Thank you so much & I'm glad that you like this article.