11 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Debounce - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/Debounce | reference | web, html, css, javascript, documentation | 2026-05-05T05:29:20.487495+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
Debounce
Debouncing , in the context of programming, means to discard operations that occur too close together during a specific interval, and consolidate them into a single invocation.
Debouncing is very similar to throttling. The key difference is that throttling enforces limits on continuous operations, while debouncing waits for invocations to stop for a specific time to consolidate many noisy invocations into one single invocation.
A typical use case of debouncing is when responding to user input. When the user is typing, no other action should be taken to avoid the UI becoming laggy. When the user pauses typing, we can start processing the input, such as filtering results, giving suggestions, etc. If the function search is debounced by 10 milliseconds, it means:
- The first call to
searchis known as the leading edge. - For every next call to
search, if it is within 10 milliseconds from the previous call, it is in the same "batch" as the previous call. - After 10 milliseconds have elapsed from the last call to
search, if no other calls have happened, we have reached the trailing edge.
Usually, search is executed once on the trailing edge only, although sometimes it might be executed on the leading edge, or even both edges, depending on the specific use case. If executed on both edges, the debouncing implementation usually also ensures that the next leading edge invocation doesn't fire at least 10 milliseconds after the previous trailing edge.
In this article
See also
- Glossary terms:
- Debouncing and Throttling Explained Through Examples on CSS-Tricks (April 6, 2016)