Type alias Task

Task: {
    cronjob?: CronJob;
    description?: string;
    method: ((brick) => any);
    name?: string;
    onComplete?: ((brick) => any);
    schedule: string | Date;
    start?: boolean;
    timezone?: string;
}

Represents a Scheduled Task with a name, optional description, schedule, start flag, optional timezone and a method.

Tasks are powered by the node-cron package.

An object of this type can be passed to the schedule method.

Type declaration

  • Optional cronjob?: CronJob

    An optional CronJob instance associated with the task.

  • Optional description?: string

    An optional description of the task.

  • method: ((brick) => any)
      • (brick): any
      • The method to be executed when the task is run.

        Parameters

        Returns any

  • Optional name?: string

    The name of the task.

  • Optional onComplete?: ((brick) => any)
      • (brick): any
      • The method to be executed when the task is completed.

        Parameters

        Returns any

  • schedule: string | Date

    The schedule for the task. This can be a cron string or a Date object.

  • Optional start?: boolean

    A flag indicating whether the task should start immediately. If not set to true, you must call task.cronjob.start() manually

  • Optional timezone?: string

    An optional timezone for the task.