concall
v1.0.0
Published
Debounce, throttle, delay and repeat
Downloads
1
Maintainers
Readme
⚙️ Installation
npm i concall
CDN Links:
- https://cdn.jsdelivr.net/npm/concall
- https://www.unpkg.com/concall
📖 Usage
◉ Import
// ES6
import concall from "concall";
// commonjs
const concall = require("concall");
◉ Debounce
const func = concall.debounce((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
func("Hello world!");
func("Hello world!");
◉ Throttle
const func = concall.throttle((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
func("Hello world!");
func("Hello world!");
◉ Delay
const func = concall.delay((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
◉ Repeat forever
const func = concall.repeat((text) => {
console.log(text);
}, 2000); // (function, delay)
func("Hello world!");
◉ Repeat "n" times
const func = concall.repeat((text) => {
console.log(text);
}, 2000, 2); // (function, delay, times)
func("Hello world!"); // will repeat 2 times