Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 463 Bytes

debounce.md

File metadata and controls

19 lines (14 loc) · 463 Bytes

Debounce

Further reading: https://davidwalsh.name/javascript-debounce-function

Ensuring a given task doesn't fire so often that it bricks browser performance.

import debounce from "@runroom/purejs/lib/debounce";

// Usage
window.addEventListener(
    "resize",
    debounce(() => {
        // Your awesome code
    })
);

Note: for a better resize event check this