You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this code, we use the `CronJob` object from the `cron` package to create the cron job. The `CronJob` constructor takes a cron pattern (just like the `@Cron()` <ahref="techniques/task-scheduling#declarative-cron-jobs">decorator</a>) as its first argument, and a callback to be executed when the cron timer fires as its second argument. The `SchedulerRegistry.addCronJob()` method takes two arguments: a name for the `CronJob`, and the `CronJob` object itself.
278
+
In this code, we use the `CronJob` object from the `cron` package to create the cron job. The `CronJob` constructor takes a cron pattern (just like the `@Cron()` <ahref="techniques/task-scheduling#declarative-cron-jobs">decorator</a>) as its first argument, and a callback to be executed when the cron timer fires as its second argument. The `SchedulerRegistry#addCronJob` method takes two arguments: a name for the `CronJob`, and the `CronJob` object itself.
279
279
280
280
> warning **Warning** Remember to inject the `SchedulerRegistry` before accessing it. Import `CronJob` from the `cron` package.
281
281
282
-
**Delete** a named cron job using the `SchedulerRegistry.deleteCronJob()` method, as follows:
282
+
**Delete** a named cron job using the `SchedulerRegistry#deleteCronJob` method, as follows:
283
283
284
284
```typescript
285
285
deleteCron(name: string) {
@@ -288,7 +288,7 @@ deleteCron(name: string) {
288
288
}
289
289
```
290
290
291
-
**List** all cron jobs using the `SchedulerRegistry.getCronJobs()` method as follows:
291
+
**List** all cron jobs using the `SchedulerRegistry#getCronJobs` method as follows:
292
292
293
293
```typescript
294
294
getCrons() {
@@ -309,7 +309,7 @@ The `getCronJobs()` method returns a `map`. In this code, we iterate over the ma
309
309
310
310
#### Dynamic intervals
311
311
312
-
Obtain a reference to an interval with the `SchedulerRegistry.getInterval()` method. As above, inject `SchedulerRegistry` using standard constructor injection:
312
+
Obtain a reference to an interval with the `SchedulerRegistry#getInterval` method. As above, inject `SchedulerRegistry` using standard constructor injection:
**List** all intervals using the `SchedulerRegistry.getIntervals()` method as follows:
350
+
**List** all intervals using the `SchedulerRegistry#getIntervals` method as follows:
351
351
352
352
```typescript
353
353
getIntervals() {
@@ -358,10 +358,10 @@ getIntervals() {
358
358
359
359
#### Dynamic timeouts
360
360
361
-
Obtain a reference to a timeout with the `SchedulerRegistry.getTimeout()` method. As above, inject `SchedulerRegistry` using standard constructor injection:
361
+
Obtain a reference to a timeout with the `SchedulerRegistry#getTimeout` method. As above, inject `SchedulerRegistry` using standard constructor injection:
0 commit comments