0.1.1 • Published 4 years ago
clock-scheduler v0.1.1
clock-scheduler
Same as setTimeout
and setInterval
but pinned to the clock.
import Clock from 'clock-scheduler';
const Clock = require('clock-scheduler');
// https://unpkg.com/clock-scheduler
// will log next date whenever the next minute will tick
const uid = Clock.setTimeout(
// a callback to invoke at next clock tick
random => console.log(random, new Date),
// second(s), minute(s), hour(s), day(s), month(s), year(s)
'minute',
// any extra argument allowed, just like setInterval/Timeout
Math.random()
);
// Clock.clearInterval(uid);