Package Exports
- debop
- debop/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (debop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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.