1.0.6 • Published 8 years ago

callevery v1.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

#callEvery setInterval on steroids for node.

##Usage

npm i -S callevery

The package exports a default function which takes a string argument in the format "hh:mm:ss". It returns another function which takes varying number arguments: the function to be called after the set duration and all the arguments to be passed to this function if any.

import callEvery from 'callevery';

const callEveryFiveSeconds = callEvery("00:00:05");

const logX = (x, y) => {
 console.log(x+y);
}

const timer1 = callEveryFiveSeconds(logX, "WestCoast", "BestCoast"); // Logs WestCoastBestCoast every 5 seconds

const timer2 = callEvery("00:00:01")(logX, "a", "b"); // Alternatively

clearInterval(timer1);
clearInterval(timer2);
1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago