Analysis updated 2026-08-02 · repo last pushed 2026-03-11
Prevent a search box from querying the server on every keystroke by waiting until the user stops typing.
Stop accidental double-submissions on buttons by using the immediate mode to fire once and ignore extra clicks.
Wrap a window resize handler so it only runs once after the user finishes dragging the browser edge.
Delay an autosave function until the user pauses editing so it does not fire on every keystroke.
| sindresorhus/debounce | justjavac/chromesnifferplus | namastedev/namaste-react | |
|---|---|---|---|
| Stars | 850 | 847 | 858 |
| Language | JavaScript | JavaScript | JavaScript |
| Last pushed | 2026-03-11 | — | — |
| Maintenance | Maintained | — | — |
| Setup difficulty | easy | easy | easy |
| Complexity | 1/5 | 1/5 | 1/5 |
| Audience | developer | developer | vibe coder |
Figures from each repo's GitHub metadata at analysis time.
Install with npm and import the single function, no configuration or external dependencies required.
Debounce is a small JavaScript utility that prevents a function from running too many times in quick succession. Instead of executing every time it's called, it waits until a specified amount of time has passed without any new calls before actually running. This is useful when something triggers frequently and you only care about the final action. The classic example is handling browser window resizing. Without any protection, a resize function might fire dozens of times per second as a user drags the edge of their browser window. With debounce, you wrap that function and set a delay of, say, 200 milliseconds. Now the function only runs once, 200ms after the user stops resizing. Each new call during the wait period resets the timer, so the function waits until things settle down. Anyone building a web interface where user actions fire repeatedly would find this handy. Beyond window resizing, common use cases include search boxes that query a server as you type, autosave features that should wait until you stop editing, and button clicks where you want to prevent accidental double-submissions. There's an "immediate" mode that runs the function right away on the first call rather than waiting, which is specifically designed to stop double-clicks on buttons. The tool also provides a few control methods on the wrapped function. You can check whether a delayed execution is still pending, cancel a scheduled run entirely, force it to execute immediately if one is waiting, or trigger it on demand while clearing any existing timer. The project is intentionally minimal and focused, doing one thing cleanly without extra complexity.
Debounce is a tiny JavaScript helper that delays running a function until calls stop coming in, preventing it from firing too many times in quick succession.
Mainly JavaScript. The stack also includes JavaScript.
Maintained — commit in last 6 months (last push 2026-03-11).
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.