Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 858f66e

Browse filesBrowse files
VoltrexKeyvadanielleadams
authored andcommitted
doc: add missing parameter types
Both of the `clearTimeout()` and `clearInterval()` functions in the `timers` lib accepts the ID of the `Timeout` object returned by the functions in a number or string type, e.g. ```js const t = setTimeout(console.log, 5000, 'test'); clearTimeout(t[Symbol.toPrimitive]()); ``` PR-URL: #39013 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c20e28e commit 858f66e
Copy full SHA for 858f66e

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Collapse file

‎doc/api/timers.md‎

Copy file name to clipboardExpand all lines: doc/api/timers.md
+5-2Lines changed: 5 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ Cancels an `Immediate` object created by [`setImmediate()`][].
307307
added: v0.0.1
308308
-->
309309

310-
* `timeout` {Timeout} A `Timeout` object as returned by [`setInterval()`][].
310+
* `timeout` {Timeout|string|number} A `Timeout` object as returned by [`setInterval()`][]
311+
or the [primitive][] of the `Timeout` object as a string or a number.
311312

312313
Cancels a `Timeout` object created by [`setInterval()`][].
313314

@@ -316,7 +317,8 @@ Cancels a `Timeout` object created by [`setInterval()`][].
316317
added: v0.0.1
317318
-->
318319

319-
* `timeout` {Timeout} A `Timeout` object as returned by [`setTimeout()`][].
320+
* `timeout` {Timeout|string|number} A `Timeout` object as returned by [`setTimeout()`][]
321+
or the [primitive][] of the `Timeout` object as a string or a number.
320322

321323
Cancels a `Timeout` object created by [`setTimeout()`][].
322324

@@ -478,3 +480,4 @@ const interval = 100;
478480
[`setTimeout()`]: timers.md#timers_settimeout_callback_delay_args
479481
[`util.promisify()`]: util.md#util_util_promisify_original
480482
[`worker_threads`]: worker_threads.md
483+
[primitive]: timers.md#timers_timeout_symbol_toprimitive

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.