Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

docs:events clarify that emitter.listener() returns a copy #9321

Closed
wants to merge 1 commit into from

Conversation

bsteephenson
Copy link

Clarifies that emitter.listener() returns a copy, not a reference
Resolves issue #9022

@@ -104,7 +104,7 @@ Note that `emitter.setMaxListeners(n)` still has precedence over

### emitter.listeners(event)

Returns an array of listeners for the specified event.
Returns a copy of an array of listeners for the specified event.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change this to Returns a copy of the array...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be lying though. Sometimes that array doesn't exist until you call .listeners(event)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems like an implementation detail that shouldn't be relevant to a user of the API.

@jasnell
Copy link
Member

jasnell commented Mar 3, 2015

LGTM ... happy with either "an" or "the"

@bsteephenson
Copy link
Author

I'll change it to "the" haha. Let me just figure out how to make the change without adding an extra commit.

Clarifies that emitter.listener() returns a copy, not a reference
Resolves issue nodejs#9022
@jasnell
Copy link
Member

jasnell commented Jun 29, 2015

LGTM. Will land shortly in a batch with other doc improvements...

@jasnell jasnell added the doc label Aug 14, 2015
@jasnell
Copy link
Member

jasnell commented Aug 14, 2015

Closing this. Landed in nodejs/node

@jasnell jasnell closed this Aug 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants