Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f1b22b2

Browse files
Samuel Mills (Henchman)jBarz
Samuel Mills (Henchman)
authored andcommittedNov 4, 2016
docs: event emitter behavior notice
Updated documentation as per the issue below: nodejs#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#25467 Reviewed-By: jasnell - James M Snell <[email protected]>
1 parent 655fbb9 commit f1b22b2

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)
This repository has been archived.