Skip to content

Commit 9079d3f

Browse files
authored
doc: domain.add() does not accept timer objects
PR-URL: #60675 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
1 parent 04a086a commit 9079d3f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

doc/api/domain.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -289,24 +289,26 @@ To handle the errors that it catches, listen to its `'error'` event.
289289

290290
* Type: {Array}
291291

292-
An array of timers and event emitters that have been explicitly added
293-
to the domain.
292+
An array of event emitters that have been explicitly added to the domain.
294293

295294
### `domain.add(emitter)`
296295

297-
* `emitter` {EventEmitter|Timer} emitter or timer to be added to the domain
296+
<!-- YAML
297+
changes:
298+
- version: v9.3.0
299+
pr-url: https://github.com/nodejs/node/pull/16222
300+
description: No longer accepts timer objects.
301+
-->
302+
303+
* `emitter` {EventEmitter} emitter to be added to the domain
298304

299305
Explicitly adds an emitter to the domain. If any event handlers called by
300306
the emitter throw an error, or if the emitter emits an `'error'` event, it
301307
will be routed to the domain's `'error'` event, just like with implicit
302308
binding.
303309

304-
This also works with timers that are returned from [`setInterval()`][] and
305-
[`setTimeout()`][]. If their callback function throws, it will be caught by
306-
the domain `'error'` handler.
307-
308-
If the Timer or `EventEmitter` was already bound to a domain, it is removed
309-
from that one, and bound to this one instead.
310+
If the `EventEmitter` was already bound to a domain, it is removed from that
311+
one, and bound to this one instead.
310312

311313
### `domain.bind(callback)`
312314

@@ -398,7 +400,7 @@ d.on('error', (er) => {
398400

399401
### `domain.remove(emitter)`
400402

401-
* `emitter` {EventEmitter|Timer} emitter or timer to be removed from the domain
403+
* `emitter` {EventEmitter} emitter to be removed from the domain
402404

403405
The opposite of [`domain.add(emitter)`][]. Removes domain handling from the
404406
specified emitter.
@@ -484,6 +486,4 @@ promises. In other words, no `'error'` event will be emitted for unhandled
484486
[`domain.add(emitter)`]: #domainaddemitter
485487
[`domain.bind(callback)`]: #domainbindcallback
486488
[`domain.exit()`]: #domainexit
487-
[`setInterval()`]: timers.md#setintervalcallback-delay-args
488-
[`setTimeout()`]: timers.md#settimeoutcallback-delay-args
489489
[`throw`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw

0 commit comments

Comments
 (0)