croner 9.0.0-dev.0 → 9.0.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,21 +26,21 @@ Quick examples:
26
26
 
27
27
  ```javascript
28
28
  // Basic: Run a function at the interval defined by a cron expression
29
- const job = Cron('*/5 * * * * *', () => {
29
+ const job = new Cron('*/5 * * * * *', () => {
30
30
  console.log('This will run every fifth second');
31
31
  });
32
32
 
33
33
  // Enumeration: What dates do the next 100 sundays occur on?
34
- const nextSundays = Cron('0 0 0 * * 7').nextRuns(100);
34
+ const nextSundays = new Cron('0 0 0 * * 7').nextRuns(100);
35
35
  console.log(nextSundays);
36
36
 
37
37
  // Days left to a specific date
38
- const msLeft = Cron('59 59 23 24 DEC *').nextRun() - new Date();
38
+ const msLeft = new Cron('59 59 23 24 DEC *').nextRun() - new Date();
39
39
  console.log(Math.floor(msLeft/1000/3600/24) + " days left to next christmas eve");
40
40
 
41
41
  // Run a function at a specific date/time using a non-local timezone (time is ISO 8601 local time)
42
42
  // This will run 2024-01-23 00:00:00 according to the time in Asia/Kolkata
43
- Cron('2024-01-23T00:00:00', { timezone: 'Asia/Kolkata' }, () => { console.log('Yay!') });
43
+ new Cron('2024-01-23T00:00:00', { timezone: 'Asia/Kolkata' }, () => { console.log('Yay!') });
44
44
 
45
45
  ```
46
46
 
@@ -96,13 +96,13 @@ Cron takes three arguments
96
96
  // - First: Cron pattern, js date object (fire once), or ISO 8601 time string (fire once)
97
97
  // - Second: Options (optional)
98
98
  // - Third: Function run trigger (optional)
99
- const job = Cron("* * * * * *", { maxRuns: 1 }, () => {} );
99
+ const job = new Cron("* * * * * *", { maxRuns: 1 }, () => {} );
100
100
 
101
101
  // If function is omitted in constructor, it can be scheduled later
102
102
  job.schedule(job, /* optional */ context) => {});
103
103
  ```
104
104
 
105
- The job will be sceduled to run at next matching time unless you supply option `{ paused: true }`. The `Cron(...)` constructor will return a Cron instance, later called `job`, which have a couple of methods and properties listed below.
105
+ The job will be sceduled to run at next matching time unless you supply option `{ paused: true }`. The `new Cron(...)` constructor will return a Cron instance, later called `job`, which have a couple of methods and properties listed below.
106
106
 
107
107
  #### Status
108
108