Skip to content

Commit 8bec8aa

Browse files
benglMyles Borins
authored and
Myles Borins
committedApr 5, 2016
doc: consolidate timers docs in timers.markdown
Rather than attempting to keep two versions of docs for timers up to date, keep them in timers.markdown, and leave references to them in globals.markdown. Add setImmediate and clearImmediate to globals.markdown. Change "To schedule" to "Schedules" in timers.markdown. PR-URL: #5837 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Claudio Rodriguez <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent a40b0cb commit 8bec8aa

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed
 

‎doc/api/globals.markdown

+27-24
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,23 @@ console.log(__filename);
5050

5151
`__filename` isn't actually a global but rather local to each module.
5252

53-
## clearInterval(t)
53+
## clearImmediate(immediateObject)
5454

55-
Stop a timer that was previously created with [`setInterval()`][]. The callback
56-
will not execute.
55+
<!--type=global-->
56+
57+
[`clearImmediate`] is described in the [timers][] section.
58+
59+
## clearInterval(intervalObject)
5760

5861
<!--type=global-->
5962

60-
The timer functions are global variables. See the [timers][] section.
63+
[`clearInterval`] is described in the [timers][] section.
6164

62-
## clearTimeout(t)
65+
## clearTimeout(timeoutObject)
66+
67+
<!--type=global-->
6368

64-
Stop a timer that was previously created with [`setTimeout()`][]. The callback will
65-
not execute.
69+
[`clearTimeout`] is described in the [timers][] section.
6670

6771
## console
6872

@@ -162,34 +166,33 @@ left untouched.
162166
Use the internal `require()` machinery to look up the location of a module,
163167
but rather than loading the module, just return the resolved filename.
164168

165-
## setInterval(cb, ms)
169+
## setImmediate(callback[, arg][, ...])
166170

167-
Run callback `cb` repeatedly every `ms` milliseconds. Note that the actual
168-
interval may vary, depending on external factors like OS timer granularity and
169-
system load. It's never less than `ms` but it may be longer.
171+
<!-- type=global -->
172+
173+
[`setImmediate`] is described in the [timers][] section.
170174

171-
The interval must be in the range of 1-2,147,483,647 inclusive. If the value is
172-
outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
173-
cannot span more than 24.8 days.
175+
## setInterval(callback, delay[, arg][, ...])
174176

175-
Returns an opaque value that represents the timer.
177+
<!-- type=global -->
176178

177-
## setTimeout(cb, ms)
179+
[`setInterval`] is described in the [timers][] section.
178180

179-
Run callback `cb` after *at least* `ms` milliseconds. The actual delay depends
180-
on external factors like OS timer granularity and system load.
181+
## setTimeout(callback, delay[, arg][, ...])
181182

182-
The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
183-
outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
184-
cannot span more than 24.8 days.
183+
<!-- type=global -->
185184

186-
Returns an opaque value that represents the timer.
185+
[`setTimeout`] is described in the [timers][] section.
187186

188187
[`console`]: console.html
189188
[`process` object]: process.html#process_process
190-
[`setInterval()`]: #globals_setinterval_cb_ms
191-
[`setTimeout()`]: #globals_settimeout_cb_ms
192189
[buffer section]: buffer.html
193190
[module system documentation]: modules.html
194191
[Modules]: modules.html#modules_modules
195192
[timers]: timers.html
193+
[`clearImmediate`]: timers.html#timers_clearimmediate_immediateobject
194+
[`clearInterval`]: timers.html#timers_clearinterval_intervalobject
195+
[`clearTimeout`]: timers.html#timers_cleartimeout_timeoutobject
196+
[`setImmediate`]: timers.html#timers_setimmediate_callback_arg
197+
[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg
198+
[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg

‎doc/api/timers.markdown

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Returns the timer.
2727

2828
## setImmediate(callback[, arg][, ...])
2929

30-
To schedule the "immediate" execution of `callback` after I/O events'
30+
Schedules "immediate" execution of `callback` after I/O events'
3131
callbacks and before timers set by [`setTimeout`][] and [`setInterval`][] are
3232
triggered. Returns an `immediateObject` for possible use with
3333
[`clearImmediate`][]. Additional optional arguments may be passed to the
@@ -40,7 +40,7 @@ until the next event loop iteration.
4040

4141
## setInterval(callback, delay[, arg][, ...])
4242

43-
To schedule the repeated execution of `callback` every `delay` milliseconds.
43+
Schedules repeated execution of `callback` every `delay` milliseconds.
4444
Returns a `intervalObject` for possible use with [`clearInterval`][]. Additional
4545
optional arguments may be passed to the callback.
4646

@@ -50,7 +50,7 @@ milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
5050

5151
## setTimeout(callback, delay[, arg][, ...])
5252

53-
To schedule execution of a one-time `callback` after `delay` milliseconds.
53+
Schedules execution of a one-time `callback` after `delay` milliseconds.
5454
Returns a `timeoutObject` for possible use with [`clearTimeout`][]. Additional
5555
optional arguments may be passed to the callback.
5656

0 commit comments

Comments
 (0)
Please sign in to comment.