Suppose we have a Sign up form, and we are validating the Email asynchronously on key press event (Any arbitrarily selected event), Now every time the user presses a particular key a request is sent to the server.
For example the user now rapidly presses and launches the event of pressing the key a 100 times, the server will register 100 requests in a very short span of time. In such a case our machine can exhibit unexpected behavior. Now to prevent this problem we introduce the concept of Debounce.
Technical overview of the working of Debounce
Through the algorithm of debounce we make sure that whenever we fire an event the request is sent after a defined amount of time, In the case of the rapid event fires the request is sent only for the last fire that too after the defined time.
Implementation of Debounce
Suppose that we are calling a function to get data from the server.