1.0.0 • Published 2 years ago
@bearcookie/throttle-debounce v1.0.0
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();
1.0.0
2 years ago