DEV Community

taiseen
taiseen

Posted on

1

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.

Heroku

Amplify your impact where it matters most β€” building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

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.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay