Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
docs: event emitter behavior notice
Browse files Browse the repository at this point in the history
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 <jasnell@gmail.com>
  • Loading branch information
Samuel Mills (Henchman) authored and jBarz committed Nov 4, 2016
1 parent 655fbb9 commit f1b22b2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/events.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ Execute each of the listeners in order with the supplied arguments.

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

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


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

Expand Down

0 comments on commit f1b22b2

Please sign in to comment.