Skip to content

Overview / WhiteRabbit

WhiteRabbit ​

Methods ​

getJobs() ​

getJobs(): Record<string, CronJob>

Retrieve the current scheduled jobs

Returns ​

Record<string, CronJob>

An array of jobs


pauseJob() ​

pauseJob(name): undefined | boolean

Pause a scheduled job

Parameters ​

ParameterTypeDescription
namestringThe name assigned to the job

Returns ​

undefined | boolean

A boolean indicating if the job was successfully paused


removeJob() ​

removeJob(name): boolean

Removes a scheduled job

Parameters ​

ParameterTypeDescription
namestringThe name assigned to the job

Returns ​

boolean

A boolean indicating if the job was successfully removed


resumeJob() ​

resumeJob(name): undefined | boolean

Resume a paused job

Parameters ​

ParameterTypeDescription
namestringThe name assigned to the job

Returns ​

undefined | boolean

A boolean indicating if the job was successfully resumed


scheduleJob() ​

scheduleJob(name, pattern, job, options?): void

Schedule a new job

Parameters ​

ParameterTypeDescription
namestringThe name to assign to the job
patternDate | CronPatternThe cron pattern to use
job() => void | Promise<void>The function to run
options?CronOptionsAdditional options

Returns ​

void


getInstance() ​

static getInstance(): Promise<WhiteRabbit>

Returns ​

Promise<WhiteRabbit>

Released under the GPL-3.0 License.