@defer/client
defer.cron()
The defer.cron(fn, schedule, options)
function allows to run a function
recurrently in the brackground.
Example:
import { defer } from "@defer/client";
const sayHello = async () => console.log(`hello!`);
export default defer.cron(sayHello, "5 0 * * *");
A function wrapped by
defer.cron()
cannot have argumentsSchedule expression
schedule
string
A valid CRON expression. Determines the schedule for your background job.
Examples:
export default defer.cron(sayHello, "*/5 * * * *");
Options
The defer.cron()
function takes the
same options as defer()
.
Was this page helpful?