debop
v1.0.0
Published
debop — a playful, minimalist debounce utility for JavaScript and Node.js.
Maintainers
Readme
debop
A playful, minimalist debounce utility for JavaScript and Node.js
Why debop?
When your app fires events faster than it can handle, debop steps in to “bop” extra calls away, ensuring your handler only runs once after the flurry subsides.
- Tiny & tree-shakeable ES module
- Zero dependencies
- Works in browsers and Node.js
- Fun & memorable name
Install
npm install debopUsage
import { debop } from 'debop';
const onResize = debop(() => {
console.log('Resized!');
}, 200);
window.addEventListener('resize', onResize);API
debop(fn: Function, delay?: number): Function
- fn — Function to debounce
- delay — Time in ms to wait after last call (default
300) - Returns — A debounced version of
fn
Test
npm testThis runs test.js and should print:
✅ debop test passed: called exactly onceLicense
MIT © Geoffrey Callaghan
Sponsorship
This project is proudly sponsored by FabForm.io — effortless form and data handling for modern web apps.
