Package Exports
- mini-debounce-fn
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 (mini-debounce-fn) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
MiniDebounce
An extremely tiny library for debouncing.
Installation
npm i mini-debounce-fnExamples
import miniDebounce from "mini-debounce-fn";
window.onscroll = miniDebounce(console.log, 150);
// callback is called every 150msimport miniDebounce from "mini-debounce-fn";
window.onmousemove = miniDebounce(({ clientX, clientY }) => {
console.log(`X: ${clientX}, Y: ${clientY}`);
}, 200);How it works
This library doesn't work as same as other libraries for debouncing. Instead of clearing timeout library checks if some timeout is already running and if so then callback won't be executed.
If this isn't your desired functionality, use some other library instead.