1.0.0 • Published 2 years ago
@fvilers/debounce v1.0.0
@fvilers/debounce
A TypeScript friendly function debouncer
Installation
npm install @fvilers/debounce
or
yarn add @fvilers/debounce
Usage
import { debounce } from "@fvilers/debounce";
function doWork(id: number) {
console.log("Working on", id);
}
const debounced = debounce(doWork, 1000);
debounced(1);
debounced(2);
debounced(3);
debounced(4);
It will output (after approximately 1000 ms):
Working on 4
1.0.0
2 years ago