Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "new" keyword to examples #265

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/usage/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ console.log('Will run first time at', job.nextRun().toLocaleString());
### Interval
```ts
// Trigger on specific interval combined with cron expression
Cron('* * 7-16 * * MON-FRI', { interval: 90 }, function () {
new Cron('* * 7-16 * * MON-FRI', { interval: 90 }, function () {
console.log('This will trigger every 90th second at 7-16 on mondays to fridays.');
});
```
Expand Down Expand Up @@ -216,7 +216,7 @@ const blockForAWhile = (ms) => new Promise(resolve => setTimeout(resolve, ms));
const protectCallback = (job) => console.log(`Call at ${new Date().toISOString()} were blocked by call started at ${job.currentRun().toISOString()}`);

// protect: can be set to ether true or a callback function, to enable over-run protection
Cron("* * * * * *", { protect: protectCallback }, async (job) => {
new Cron("* * * * * *", { protect: protectCallback }, async (job) => {
console.log(`Call started at ${job.currentRun().toISOString()} started`);
await blockForAWhile(4000);
console.log(`Call started at ${job.currentRun().toISOString()} finished ${new Date().toISOString()}`);
Expand Down