Wiki

Clone wiki

scheduler-cron / IntervalJob

IntervalJob

It is designed for execution in specified interval

Options

  • interval - the interval in which function will be executed

    type: Number | function

    • returns: Number - the next interval
  • func - the function that will be executed

    type: function

    • returns: undefined
  • options

    • startDate - the date when function execution will be started

      type: Date

Methods

  • stop - stops function execution

    returns: undefined

How to use

var IntervalJob = require('scheduler-cron').IntervalJob;
var hourInterval = 1000 * 60 * 60;

new IntervalJob(hourInterval, function() {
    // Send a congratulatory message to the users' chat
}, {
    startDate: new Date(2017, 0, 1)
});

Updated