@types/node-schedule

  • Version 2.1.7
  • Published
  • 9.3 kB
  • 1 dependency
  • MIT license

Install

npm i @types/node-schedule
yarn add @types/node-schedule
pnpm add @types/node-schedule

Overview

TypeScript definitions for node-schedule

Index

Variables

variable scheduledJobs

let scheduledJobs: { [jobName: string]: Job };
  • Dictionary of all Jobs, accessible by name.

Functions

function cancelJob

cancelJob: (job: Job | string) => boolean;
  • Cancels the job.

    Returns

    Whether the job has been cancelled with success.

function gracefulShutdown

gracefulShutdown: () => Promise<void>;
  • Gracefullly cancels all jobs.

    Returns

    Promise that resolves when all running jobs have stopped.

function rescheduleJob

rescheduleJob: (
job: Job | string,
spec:
| RecurrenceRule
| RecurrenceSpecDateRange
| RecurrenceSpecObjLit
| Date
| string
) => Job;
  • Changes the timing of a Job, canceling all pending invocations.

    Parameter spec

    The new timing for this Job. if the job could be rescheduled, {null} otherwise.

function scheduleJob

scheduleJob: {
(name: string, spec: Spec, callback: JobCallback): Job;
(spec: Spec, callback: JobCallback): Job;
};
  • Create a schedule job.

    Parameter name

    name for the new Job

    Parameter spec

    scheduling info

    Parameter callback

    callback to be executed on each invocation

  • Create a schedule job.

    Parameter spec

    scheduling info

    Parameter callback

    callback to be executed on each invocation

Classes

class Invocation

class Invocation {}

    constructor

    constructor(job: Job, fireDate: Date, recurrenceRule: RecurrenceRule);

      property fireDate

      fireDate: Date;

        property job

        job: Job;

          property recurrenceRule

          recurrenceRule: RecurrenceRule;

            property timerID

            timerID: number;

              class Job

              class Job extends EventEmitter {}
              • Scheduler jobs.

              property name

              readonly name: string;

                property pendingInvocations

                pendingInvocations: Invocation[];
                • A list of all pending Invocations.

                method cancel

                cancel: (reschedule?: boolean) => boolean;
                • Cancel all pending Invocations of this Job.

                  Parameter reschedule

                  whether to reschedule the canceled Invocations.

                method cancelNext

                cancelNext: (reschedule?: boolean) => boolean;
                • Cancel the next Invocation of this Job.

                  Parameter reschedule

                  whether to reschedule the canceled Invocation. whether cancelation was successful

                method invoke

                invoke: () => void;
                • Run this Job immediately.

                method nextInvocation

                nextInvocation: () => Date;
                • The Date on which this Job will be run next.

                method reschedule

                reschedule: (spec: Spec) => boolean;
                • Changes the scheduling information for this Job. whether the reschedule was successful

                method runOnDate

                runOnDate: (date: Date) => void;
                • Schedule this Job to be run on the specified date.

                method schedule

                schedule: (spec: Spec) => boolean;
                • Set scheduling information

                class Range

                class Range {}

                  constructor

                  constructor(start?: number, end?: number, step?: number);

                    method contains

                    contains: (value: number) => boolean;
                    • Whether the class contains the specified value.

                    class RecurrenceRule

                    class RecurrenceRule {}

                      constructor

                      constructor(
                      year?: RecurrenceSegment,
                      month?: RecurrenceSegment,
                      date?: RecurrenceSegment,
                      dayOfWeek?: RecurrenceSegment,
                      hour?: RecurrenceSegment,
                      minute?: RecurrenceSegment,
                      second?: RecurrenceSegment,
                      tz?: string
                      );

                        property date

                        date: RecurrenceSegment;
                        • Day of the month.

                        property dayOfWeek

                        dayOfWeek: RecurrenceSegment;

                          property hour

                          hour: RecurrenceSegment;

                            property minute

                            minute: RecurrenceSegment;

                              property month

                              month: RecurrenceSegment;

                                property second

                                second: RecurrenceSegment;

                                  property tz

                                  tz: string;

                                    property year

                                    year: RecurrenceSegment;

                                      method isValid

                                      isValid: () => boolean;

                                        method nextInvocationDate

                                        nextInvocationDate: (base: Date) => Date;

                                          Interfaces

                                          interface RecurrenceSpecDateRange

                                          interface RecurrenceSpecDateRange {}
                                          • Recurrence rule specification using a date range and cron expression.

                                          property end

                                          end?: Date | string | number | undefined;
                                          • Ending date in date range.

                                          property rule

                                          rule: string;
                                          • Cron expression string.

                                          property start

                                          start?: Date | string | number | undefined;
                                          • Starting date in date range.

                                          property tz

                                          tz?: Timezone | undefined;
                                          • Timezone

                                          interface RecurrenceSpecObjLit

                                          interface RecurrenceSpecObjLit {}
                                          • Recurrence rule specification using object literal syntax.

                                          property date

                                          date?: RecurrenceSegment | undefined;
                                          • Day of the month.

                                          property dayOfWeek

                                          dayOfWeek?: RecurrenceSegment | undefined;

                                            property hour

                                            hour?: RecurrenceSegment | undefined;

                                              property minute

                                              minute?: RecurrenceSegment | undefined;

                                                property month

                                                month?: RecurrenceSegment | undefined;

                                                  property second

                                                  second?: RecurrenceSegment | undefined;

                                                    property tz

                                                    tz?: Timezone | undefined;
                                                    • Timezone

                                                    property year

                                                    year?: RecurrenceSegment | undefined;

                                                      Type Aliases

                                                      type JobCallback

                                                      type JobCallback = (fireDate: Date) => void | Promise<any>;
                                                      • The callback executed by a Job

                                                      type Recurrence

                                                      type Recurrence = number | Range | string;

                                                        type RecurrenceSegment

                                                        type RecurrenceSegment = Recurrence | Recurrence[];

                                                          type Spec

                                                          type Spec =
                                                          | RecurrenceRule
                                                          | RecurrenceSpecDateRange
                                                          | RecurrenceSpecObjLit
                                                          | Date
                                                          | string
                                                          | number;
                                                          • The Spec that is used as parms for schedule to deside when it needs to be ran

                                                          type Timezone

                                                          type Timezone = string;

                                                            Package Files (1)

                                                            Dependencies (1)

                                                            Dev Dependencies (0)

                                                            No dev dependencies.

                                                            Peer Dependencies (0)

                                                            No peer dependencies.

                                                            Badge

                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/node-schedule.

                                                            • Markdown
                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/node-schedule)
                                                            • HTML
                                                              <a href="https://www.jsdocs.io/package/@types/node-schedule"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>