Skip to content

Commit be34388

Browse files
vsemozhetbytMylesBorins
authored andcommitted
doc: unify and dedupe returned values in timers.md
PR-URL: #20310 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
1 parent ccf1b24 commit be34388

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

doc/api/timers.md

+8-17
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ functions that can be used to control this default behavior.
2828
added: v9.7.0
2929
-->
3030

31-
* Returns: {Immediate}
31+
* Returns: {Immediate} a reference to `immediate`
3232

3333
When called, requests that the Node.js event loop *not* exit so long as the
3434
`Immediate` is active. Calling `immediate.ref()` multiple times will have no
@@ -37,22 +37,18 @@ effect.
3737
By default, all `Immediate` objects are "ref'ed", making it normally unnecessary
3838
to call `immediate.ref()` unless `immediate.unref()` had been called previously.
3939

40-
Returns a reference to the `Immediate`.
41-
4240
### immediate.unref()
4341
<!-- YAML
4442
added: v9.7.0
4543
-->
4644

47-
* Returns: {Immediate}
45+
* Returns: {Immediate} a reference to `immediate`
4846

4947
When called, the active `Immediate` object will not require the Node.js event
5048
loop to remain active. If there is no other activity keeping the event loop
5149
running, the process may exit before the `Immediate` object's callback is
5250
invoked. Calling `immediate.unref()` multiple times will have no effect.
5351

54-
Returns a reference to the `Immediate`.
55-
5652
## Class: Timeout
5753

5854
This object is created internally and is returned from [`setTimeout()`][] and
@@ -70,22 +66,20 @@ control this default behavior.
7066
added: v0.9.1
7167
-->
7268

73-
* Returns: {Timeout}
69+
* Returns: {Timeout} a reference to `timeout`
7470

7571
When called, requests that the Node.js event loop *not* exit so long as the
7672
`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect.
7773

7874
By default, all `Timeout` objects are "ref'ed", making it normally unnecessary
7975
to call `timeout.ref()` unless `timeout.unref()` had been called previously.
8076

81-
Returns a reference to the `Timeout`.
82-
8377
### timeout.unref()
8478
<!-- YAML
8579
added: v0.9.1
8680
-->
8781

88-
* Returns: {Timeout}
82+
* Returns: {Timeout} a reference to `timeout`
8983

9084
When called, the active `Timeout` object will not require the Node.js event loop
9185
to remain active. If there is no other activity keeping the event loop running,
@@ -96,8 +90,6 @@ Calling `timeout.unref()` creates an internal timer that will wake the Node.js
9690
event loop. Creating too many of these can adversely impact performance
9791
of the Node.js application.
9892

99-
Returns a reference to the `Timeout`.
100-
10193
## Scheduling Timers
10294

10395
A timer in Node.js is an internal construct that calls a given function after
@@ -113,9 +105,10 @@ added: v0.9.1
113105
* `callback` {Function} The function to call at the end of this turn of
114106
[the Node.js Event Loop]
115107
* `...args` {any} Optional arguments to pass when the `callback` is called.
108+
* Returns: {Immediate} for use with [`clearImmediate()`][]
116109

117110
Schedules the "immediate" execution of the `callback` after I/O events'
118-
callbacks. Returns an `Immediate` for use with [`clearImmediate()`][].
111+
callbacks.
119112

120113
When multiple calls to `setImmediate()` are made, the `callback` functions are
121114
queued for execution in the order in which they are created. The entire callback
@@ -155,10 +148,9 @@ added: v0.0.1
155148
* `delay` {number} The number of milliseconds to wait before calling the
156149
`callback`.
157150
* `...args` {any} Optional arguments to pass when the `callback` is called.
158-
* Returns: {Timeout}
151+
* Returns: {Timeout} for use with [`clearInterval()`][]
159152

160153
Schedules repeated execution of `callback` every `delay` milliseconds.
161-
Returns a `Timeout` for use with [`clearInterval()`][].
162154

163155
When `delay` is larger than `2147483647` or less than `1`, the `delay` will be
164156
set to `1`.
@@ -174,10 +166,9 @@ added: v0.0.1
174166
* `delay` {number} The number of milliseconds to wait before calling the
175167
`callback`.
176168
* `...args` {any} Optional arguments to pass when the `callback` is called.
177-
* Returns: {Timeout}
169+
* Returns: {Timeout} for use with [`clearTimeout()`][]
178170

179171
Schedules execution of a one-time `callback` after `delay` milliseconds.
180-
Returns a `Timeout` for use with [`clearTimeout()`][].
181172

182173
The `callback` will likely not be invoked in precisely `delay` milliseconds.
183174
Node.js makes no guarantees about the exact timing of when callbacks will fire,

0 commit comments

Comments
 (0)