0.1.1 • Published 4 years ago

clock-scheduler v0.1.1

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

clock-scheduler

Build Status Coverage Status WebReflection status

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);