Skip to content

Commit a24db43

Browse files
Samuel Mills (Henchman)jasnell
Samuel Mills (Henchman)
authored andcommitted
docs: event emitter behavior notice
Updated documentation as per the issue below: nodejs/node-v0.x-archive#25466 Event listeners can alter parts of the passed object, in some circumstances the changes are passed to the next listeners due to pass by reference. This is documentation of that behavior. PR-URL: nodejs/node-v0.x-archive#25467 Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
1 parent 261fa36 commit a24db43

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/events.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ Execute each of the listeners in order with the supplied arguments.
118118

119119
Returns `true` if event had listeners, `false` otherwise.
120120

121+
**Note:** Objects are passed by reference, meaning that the same object can be
122+
passed to multiple listeners. If a listener needs to modify a shared object, a
123+
copy of the object should be made.
124+
121125

122126
### Class Method: EventEmitter.listenerCount(emitter, event)
123127

0 commit comments

Comments
 (0)