Class: Cron
Workload for recurring tasks.
A Cron workload is initialized with a unique id and the following options:
schedule
in unix-cron format to specify when it should run.run
function with the code that will be executed.
Example
ts
import { Cron } from "@monolayer/sdk";
const reports = new Cron("reports", {
schedule: "* * * * *",
run: async () => {
// Do something;
},
});
export default reports;
Extends
Constructors
new Cron()
ts
new Cron(id, options): Cron
Parameters
Parameter | Type | Description |
---|---|---|
|
| Unique ID |
| ‐ |
Returns
Overrides
Properties
Property | Modifier | Type | Description |
---|---|---|---|
id | public | string | Unique ID |
options | public | CronOptions | - |
run | public | () => Promise <void > | - |
schedule | public | string | - |