@bearcookie/throttle-debounce
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

throttle-debounce

Throttle and debounce for typescript. Support ES Modules and CommonJS.

Install

npm i @bearcookie/throttle-debounce
or
yarn add @bearcookie/throttle-debounce

Usage

Throttle

import { throttle } from "@bearcookie/throttle-debounce";

const foo = throttle(() => {
    // do something
}, 1000);

Debounce

import { debounce } from "@bearcookie/throttle-debounce";

const foo = debounce(() => {
    // do something
}, 1000);

Cancel

const throttleFunc = throttle(() => {
    // do something
}, 1000);
throttleFunc.cancel();

const debounceFunc = debounce(() => {
    // do something
}, 1000);
debounceFunc.cancel();

Package Sidebar

Install

npm i @bearcookie/throttle-debounce

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

11.6 kB

Total Files

13

Last publish

Collaborators

  • bearcookie