cronticker

0.1.0 • Public • Published

CronTicker

Set cron taskes and get notified when the task should trigger.

var CronTicker = require('cronticker')
var ticker =  new CronTicker()
ticker.on('task', function(id, cur, next) {
  // id is the name you set
  // cur is the timestamp when the cron is supposed to trigger
  // next is the next timestamp when the cron is supposed to trigger
})

// cron expr starts always with second
ticker.set('mytask', '* * * * * *') // the above event listener will get called once per second
// change schedule on the fly
ticker.set('mytask', '0 * * * * *')
// when no longer needed
ticker.del('mytask')

See test/* for more examples.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    1

Package Sidebar

Install

npm i cronticker

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • jiangyangk