JSPM

mini-debounce-fn

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 12
    • Score
      100M100P100Q55762F
    • License MIT

    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-fn

    Examples

    import miniDebounce from "mini-debounce-fn";
    
    window.onscroll = miniDebounce(console.log, 150);
    // callback is called every 150ms
    import 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.