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
All `node:dns` functions are available, except `lookup`, `lookupService`, and `resolve` which throw "Not implemented" errors when called.
70
69
71
70
#### node:timers
72
71
73
72
You can use [`node:timers`](https://nodejs.org/api/timers.html) to schedule functions to be called at some future period of time.
74
73
75
74
This includes [`setTimeout`](https://nodejs.org/api/timers.html#settimeoutcallback-delay-args) for calling a function after a delay,
76
-
[`setInterval`](https://nodejs.org/api/timers.html#clearintervaltimeout) for calling a function repeatedly,
75
+
[`setInterval`](https://nodejs.org/api/timers.html#setintervalcallback-delay-args) for calling a function repeatedly,
77
76
and [`setImmediate`](https://nodejs.org/api/timers.html#setimmediatecallback-args) for calling a function in the next iteration of the event loop.
78
77
79
78
<TypeScriptExample filename="index.ts">
@@ -91,8 +90,3 @@ console.log("next");
91
90
92
91
```
93
92
</TypeScriptExample>
94
-
95
-
Note that due to [security-based restrictions on timers](/workers/reference/security-model/#step-1-disallow-timers-and-multi-threading) in Workers,
96
-
timers are limited to returning the time of the last I/O. This means that while setTimeout, setInterval, and setImmediate will defer your function execution
97
-
until after other events have run, they will not delay them for the full time specified.
@@ -19,18 +19,21 @@ import timers from 'node:timers';
19
19
20
20
console.log('first');
21
21
timers.setTimeout(() => {
22
-
console.log('last');
22
+
console.log('last');
23
23
}, 10);
24
24
25
25
timers.setTimeout(() => {
26
-
console.log('next');
26
+
console.log('next');
27
27
});
28
28
29
29
```
30
30
</TypeScriptExample>
31
31
32
-
Note that due to [security-based restrictions on timers](/workers/reference/security-model/#step-1-disallow-timers-and-multi-threading) in Workers,
32
+
:::note
33
+
Due to [security-based restrictions on timers](/workers/reference/security-model/#step-1-disallow-timers-and-multi-threading) in Workers,
33
34
timers are limited to returning the time of the last I/O. This means that while setTimeout, setInterval, and setImmediate will defer your function execution
34
35
until after other events have run, they will not delay them for the full time specified.
35
36
37
+
:::
38
+
36
39
The full `node:timers` API is documented in the [Node.js documentation for `node:timers`](https://nodejs.org/api/timers.html).
0 commit comments