croner 5.7.1-dev.0 → 6.0.0-dev.0
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 +11 -9
- package/dist/croner.js +1651 -0
- package/dist/croner.min.js +1 -1
- package/dist/croner.umd.js +1659 -0
- package/dist/croner.umd.min.js +1 -0
- package/package.json +17 -15
- package/types/croner.d.cts +402 -0
- package/types/croner.d.ts +278 -14
- package/dist/croner.min.cjs +0 -1
- package/dist/croner.min.mjs +0 -1
- package/types/croner.single.d.ts +0 -2
- package/types/date.d.ts +0 -62
- package/types/options.d.ts +0 -100
- package/types/pattern.d.ts +0 -72
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Trigger functions or evaluate cron expressions in JavaScript or TypeScript. No d
|
|
|
17
17
|
* Includes [TypeScript](https://www.typescriptlang.org/) typings.
|
|
18
18
|
* Find the first date of the next month, the date of the next Tuesday, etc.
|
|
19
19
|
* Pause, resume, or stop execution after a task is scheduled.
|
|
20
|
-
* Uses Vixie-cron [pattern](#pattern), with a few additional features such as `L` for last day of month.
|
|
20
|
+
* Uses Vixie-cron [pattern](#pattern), with a few additional features such as `L` for last day and weekday of month.
|
|
21
21
|
|
|
22
22
|
Quick examples:
|
|
23
23
|
|
|
@@ -155,7 +155,7 @@ import Cron from "croner";
|
|
|
155
155
|
JavaScript
|
|
156
156
|
|
|
157
157
|
```javascript
|
|
158
|
-
import Cron from "https://deno.land/x/croner@
|
|
158
|
+
import Cron from "https://deno.land/x/croner@6.0.0-dev.0/dist/croner.js";
|
|
159
159
|
|
|
160
160
|
Cron("* * * * * *", () => {
|
|
161
161
|
console.log("This will run every second.");
|
|
@@ -165,7 +165,7 @@ Cron("* * * * * *", () => {
|
|
|
165
165
|
TypeScript
|
|
166
166
|
|
|
167
167
|
```typescript
|
|
168
|
-
import { Cron } from "https://deno.land/x/croner@
|
|
168
|
+
import { Cron } from "https://deno.land/x/croner@6.0.0-dev.0/dist/croner.js";
|
|
169
169
|
|
|
170
170
|
const _scheduler : Cron = new Cron("* * * * * *", () => {
|
|
171
171
|
console.log("This will run every second.");
|
|
@@ -178,21 +178,21 @@ const _scheduler : Cron = new Cron("* * * * * *", () => {
|
|
|
178
178
|
|
|
179
179
|
* Download the latest [zipball](https://github.com/Hexagon/croner/archive/refs/heads/master.zip).
|
|
180
180
|
* Unpack the zip file.
|
|
181
|
-
* Grab ```croner.min.js``` (UMD and standalone) or ```croner.min.
|
|
181
|
+
* Grab ```croner.umd.min.js``` (UMD and standalone) or ```croner.min.js``` (ES-module) from the [dist/](/dist) folder.
|
|
182
182
|
|
|
183
183
|
#### CDN
|
|
184
184
|
|
|
185
185
|
To use as a [UMD](https://github.com/umdjs/umd)-module (stand alone, [RequireJS](https://requirejs.org/) etc.)
|
|
186
186
|
|
|
187
187
|
```html
|
|
188
|
-
<script src="https://cdn.jsdelivr.net/npm/croner@
|
|
188
|
+
<script src="https://cdn.jsdelivr.net/npm/croner@6/dist/croner.umd.min.js"></script>
|
|
189
189
|
```
|
|
190
190
|
|
|
191
191
|
To use as an [ES-module](https://developer.mozilla.org/en-USdocs/Web/JavaScript/Guide/Modules)
|
|
192
192
|
|
|
193
193
|
```html
|
|
194
194
|
<script type="module">
|
|
195
|
-
import Cron from "https://cdn.jsdelivr.net/npm/croner@
|
|
195
|
+
import Cron from "https://cdn.jsdelivr.net/npm/croner@6/dist/croner.min.js";
|
|
196
196
|
|
|
197
197
|
// ... see usage section ...
|
|
198
198
|
</script>
|
|
@@ -273,8 +273,8 @@ The expressions used by Croner are very similar to those of Vixie Cron, but with
|
|
|
273
273
|
```
|
|
274
274
|
|
|
275
275
|
* Croner expressions have the following additional modifiers:
|
|
276
|
-
-
|
|
277
|
-
- *L
|
|
276
|
+
- *?*: The question mark is substituted with the time of initialization. For example, ? ? * * * * would be substituted with 25 8 * * * * if the time is <any hour>:08:25 at the time of new Cron('? ? * * * *', <...>). The question mark can be used in any field.
|
|
277
|
+
- *L*: L can be used in the day of the month field to specify the last day of the month. It can also be used in the day of the week field to specify the last specific weekday of the month, for example, the last Friday.
|
|
278
278
|
|
|
279
279
|
* Croner allows you to pass a JavaScript Date object or an ISO 8601 formatted string as a pattern. The scheduled function will trigger at the specified date/time and only once. If you use a timezone different from the local timezone, you should pass the ISO 8601 local time in the target location and specify the timezone using the options (2nd parameter).
|
|
280
280
|
|
|
@@ -287,10 +287,12 @@ The expressions used by Croner are very similar to those of Vixie Cron, but with
|
|
|
287
287
|
| Hours | Yes | 0-23 | * , - / ? | |
|
|
288
288
|
| Day of Month | Yes | 1-31 | * , - / ? L | |
|
|
289
289
|
| Month | Yes | 1-12 or JAN-DEC| * , - / ? | |
|
|
290
|
-
| Day of Week | Yes | 0-7 or SUN-MON | * , - / ?
|
|
290
|
+
| Day of Week | Yes | 0-7 or SUN-MON | * , - / ? L | 0 to 6 are Sunday to Saturday<br>7 is Sunday, the same as 0 |
|
|
291
291
|
|
|
292
292
|
> **Note**
|
|
293
293
|
> Weekday and month names are case-insensitive. Both `MON` and `mon` work.
|
|
294
|
+
> When using `L` in the Day of Week field, it affects all specified weekdays. For example, `L5,6` means the last Friday and Saturday in the month."
|
|
295
|
+
|
|
294
296
|
|
|
295
297
|
It is also possible to use the following "nicknames" as pattern.
|
|
296
298
|
|