Skip to content

Axorax/concall.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

concall.js

Debouncing, throttling and more

⚙️ Installation

npm i concall

CDN Links:

📖 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

Support me on PatreonCheck out my socials