Skip to content

v2.0.0 Interval based scheduler

Choose a tag to compare

@P4sca1 P4sca1 released this 29 Oct 20:20
c0d1801
  • Renamed Schedule to Cron
  • New IntervalBasedScheduler
  • Moved setTimeout, setInterval and clearTimeoutOrInterval to TimerBasedScheduler

See README.md for instructions on how to use the new scheduler.

Quick migration guide:

// v1.x
import { parseCronExpression } from 'cron-schedule'

const schedule = parseCronExpression('* * * * *')
schedule.setTimeout(fn)
schedule.setInterval(fn)
schedule.clearTimeoutOrInterval(id)


// v2.x
import { parseCronExpression, TimerBasedScheduler as scheduler } from 'cron-schedule'

const cron = parseCronExpression('* * * * *')
scheduler.setTimeout(cron, fn)
scheduler.setInterval(cron, fn)
scheduler.clearTimeoutOrInterval(id)