Skip to content

Commit 7f51b34

Browse files
committed
review comments
1 parent 51aa208 commit 7f51b34

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

doc/api/events.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ myEmitter.emit('event');
109109
```
110110

111111
Using the `eventEmitter.once()` method, it is possible to register a listener
112-
which is called only once for a particular event. The listener is actually
113-
unregistered before it is called, when the event is emitted.
112+
that is called at most once for a particular event. Once the event is emitted,
113+
the listener is unregistered and *then* called.
114114

115115
```js
116116
const myEmitter = new MyEmitter();
@@ -141,8 +141,8 @@ myEmitter.emit('error', new Error('whoops!'));
141141
```
142142

143143
To guard against crashing the Node.js process, a listener can be registered
144-
for the `process.on('uncaughtException')` event or the [`domain`][] module can be
145-
used. (_Note, however, that the `domain` module has been deprecated_)
144+
on the [`process` object's `uncaughtException` event][] or the [`domain`][] module
145+
can be used. (_Note, however, that the `domain` module has been deprecated_)
146146

147147
```js
148148
const myEmitter = new MyEmitter();
@@ -155,8 +155,7 @@ myEmitter.emit('error', new Error('whoops!'));
155155
// Prints: whoops! there was an error
156156
```
157157

158-
As a best practice, listeners should be registered for the `'error'` events
159-
always.
158+
As a best practice, listeners should always be added for the `'error'` events.
160159

161160
```js
162161
const myEmitter = new MyEmitter();
@@ -176,7 +175,7 @@ const EventEmitter = require('events');
176175
```
177176

178177
All EventEmitters emit the event `'newListener'` when new listeners are
179-
added and `'removeListener'` when listeners are removed.
178+
added and `'removeListener'` when existing listeners are removed.
180179

181180
### Event: 'newListener'
182181

@@ -219,7 +218,7 @@ myEmitter.emit('event');
219218
* `eventName` {String|Symbol} The event name
220219
* `listener` {Function} The event handler function
221220

222-
The `'removeListener'` event is emitted *after* the listener is removed.
221+
The `'removeListener'` event is emitted *after* the `listener` is removed.
223222

224223
### EventEmitter.listenerCount(emitter, eventName)
225224

@@ -507,4 +506,5 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
507506
[`EventEmitter.defaultMaxListeners`]: #events_eventemitter_defaultmaxlisteners
508507
[`emitter.listenerCount()`]: #events_emitter_listenercount_eventname
509508
[`domain`]: domain.html
509+
[`process` object's `uncaughtException` event]: process.html#process_event_uncaughtexception
510510
[stream]: stream.html

0 commit comments

Comments
 (0)