Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UberCron

Uber-cron: Enhanced cron job scheduling. Based on cron: https://www.npmjs.com/package/cron

Hierarchy

  • CronJob
    • UberCron

Index

Constructors

constructor

Properties

fireOnTick

fireOnTick: Function

Function using to fire onTick, default set to an inner private function. Overwrite this only if you have a really good reason to do so.

Private jobName

jobName: string

Private logger

logger: ILogger

Private numParallelExecutions

numParallelExecutions: number

running

running: boolean | undefined

Return true if job is running.

Private stopOnError

stopOnError: boolean

Static jobs

jobs: object

Global jobs object holding all cron job entries for each created cron job

Type declaration

Accessors

job

Methods

addCallback

  • addCallback(callback: Function): void
  • Add another onTick function.

    Parameters

    • callback: Function

      Target function.

    Returns void

lastDate

  • lastDate(): Date
  • Tells you the last execution date.

    Returns Date

nextDates

  • nextDates(i?: number): Date
  • Tells you when a CronTime will be run.

    Parameters

    • Optional i: number

      Indicate which turn of run after now. If not given return next run time.

    Returns Date

setTime

  • setTime(time: CronTime): void
  • Change the time for the CronJob.

    Parameters

    • time: CronTime

      Target time.

    Returns void

start

  • start(): void
  • Start the cron job

    Returns void

stop

  • stop(): void
  • Stop the cron job

    Returns void

wrapTick

  • wrapTick(onTick: function): Promise<void>
  • Wrap the onTick method for extended functionality

    Parameters

    • onTick: function
        • (): void
        • Returns void

    Returns Promise<void>