Schedule
pulse.schedule(when, names, data?)
pulse.schedule(when, names, data?)
The schedule
method allows you to set a specific time for a job or multiple jobs to be executed. This is useful for tasks that must occur at precise times rather than at regular intervals.
Example Usage
Parameters
when
(string | Date
): The specific time when the job should be executed. This can be a string representing a date or aDate
object.names
(string | string[]
): The name or array of names of the job(s) to be scheduled. Each name corresponds to a job type previously defined with thedefine
method.data
(T
- optional): Data to pass to the job when it runs. This could be any type of data required by the job for its execution.
Returns
Promise<Job | Job[]>
: A promise that resolves with the created job or jobs. The promise will resolve after the job has been scheduled, or it will reject if there is an error during scheduling.
Last updated