nxtcron - v1.0.1
    Preparing search index...

    Class CronScheduler

    CronScheduler schedules callbacks to run according to a cron expression.

    Index

    Constructors

    Properties

    calculator: CronCalculator = ...
    instance?: CronScheduler
    parser: CronParser = ...

    Methods

    • Schedule a callback to run on the given cron schedule.

      Parameters

      • expr: CronInput

        A standard 5-field cron string, parsed cron object or special alias. The special '@reboot' alias fires the callback immediately once.

      • callback: () => void

        Function to invoke on each scheduled occurrence.

      • Optionaloptions: ScheduleOptions

        Optional ScheduleOptions with timezone.

      Returns ScheduleController

      A ScheduleController with stop(), on(), and off() methods.

      const job = scheduler.schedule( '0 * * * *', () => console.log( 'tick' ), { timezone: 'UTC' } );
      job.on( 'tick', () => console.log( 'about to fire' ) );
      job.stop();