1.0.0 • Published 2 years ago

@fvilers/debounce v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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