Debouncing, throttling and more
npm i concall
CDN Links:
// ES6
import concall from "concall";
// commonjs
const concall = require("concall");
const func = concall.debounce((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
func("Hello world!");
func("Hello world!");
const func = concall.throttle((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
func("Hello world!");
func("Hello world!");
const func = concall.delay((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
const func = concall.repeat((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
const func = concall.repeat((text) => {
console.log(text);
}, 2000, 2); // (function, delay, times)
func("Hello world!"); // will repeat 2 times