Skip to content

Commit 2e3de32

Browse files
authored
docs(task-scheduling): change seconds argument
The seconds argument of setTimeout and setInterval should be in milliseconds instead, and the type should be number instead of string.
1 parent 58e409b commit 2e3de32

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

content/techniques/task-scheduling.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,12 @@ clearInterval(interval);
286286
**Create** a new interval dynamically using the `SchedulerRegistry.addInterval()` method, as follows:
287287

288288
```typescript
289-
addInterval(name: string, seconds: string) {
289+
addInterval(name: string, milliseconds: number) {
290290
const callback = () => {
291-
this.logger.warn(`Interval ${name} executing at time (${seconds})!`);
291+
this.logger.warn(`Interval ${name} executing at time (${milliseconds})!`);
292292
};
293293

294-
const interval = setInterval(callback, seconds);
294+
const interval = setInterval(callback, milliseconds);
295295
this.scheduler.addInterval(name, interval);
296296
}
297297
```
@@ -335,12 +335,12 @@ clearTimeout(timeout);
335335
**Create** a new timeout dynamically using the `SchedulerRegistry.addTimeout()` method, as follows:
336336

337337
```typescript
338-
addTimeout(name: string, seconds: string) {
338+
addTimeout(name: string, milliseconds: number) {
339339
const callback = () => {
340-
this.logger.warn(`Timeout ${name} executing after (${seconds})!`);
340+
this.logger.warn(`Timeout ${name} executing after (${milliseconds})!`);
341341
};
342342

343-
const timeout = setTimeout(callback, seconds);
343+
const timeout = setTimeout(callback, milliseconds);
344344
this.scheduler.addTimeout(name, timeout);
345345
}
346346
```

0 commit comments

Comments
 (0)