Skip to content

About

🍄 Throttle for Node

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

99 Commits

Folders and files

Repository files navigation

Sudoo-Throttle

Continuous Integration codecov npm version downloads

Throttle for Node

Install

yarn add @sudoo/throttle
# Or
npm install @sudoo/throttle --save

Throttle

import { Throttle } from "@sudoo/throttle";

const throttle = Throttle.create(async (...args) => {
    await doSomethingCostALot(args);
}, 1000);

for(1000 Times){
    throttle.execute(args); // Only one will be executed every 1000 ms
}

throttle.reset(); // Cancel

Debounce

import { Debounce } from "@sudoo/throttle";

const debounce = Debounce.create(async (...args) => {
    await doSomethingCostALot(args);
}, 1000);

for(1000 Times){
    debounce.execute(args); // Only the last call will be executed since all action called within 1000 ms
}

debounce.reset(); // Cancel

About

🍄 Throttle for Node

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages