@thinice/debounce
v0.1.0
Published
Debounce a function - only executes after delay with no calls
Readme
@thinice/debounce
Debounce a function - only executes after delay with no calls.
Installation
npm install @thinice/debounceUsage
import { debounce } from "@thinice/debounce";
const search = debounce((query: string) => {
fetch(`/api/search?q=${query}`);
}, 300);
search("hello"); // executes after 300ms of no calls
search("hello world"); // resets timer, only this one executesSource
https://github.com/thinicejs/utils/tree/main/packages/debounce
