Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: missing argument types for events methods #11802

Closed

Conversation

ameliavoncat
Copy link
Contributor

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

documentation

Description of changes

Adds missing argument types to the docs for event methods

Issue

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. events Issues and PRs related to the events subsystem / EventEmitter. labels Mar 11, 2017

Alias for `emitter.on(eventName, listener)`.

### emitter.emit(eventName[, ...args])
<!-- YAML
added: v0.1.26
-->
- `eventName` {string|symbol}
- `...args` {Function[]}
Copy link
Contributor

@mscdex mscdex Mar 11, 2017

Choose a reason for hiding this comment

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

The type here isn't correct. It can be zero or more of any kind of values. I'm not sure if we've yet "standardized" on what term to use as an 'any' type.

@@ -296,13 +296,17 @@ Its `name` property is set to `'MaxListenersExceededWarning'`.
<!-- YAML
added: v0.1.26
-->
- `eventName` {string|symbol}
Copy link
Contributor

Choose a reason for hiding this comment

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

We're more lax than this. We basically accept any value, it's just that (currently) it will be converted to a string before being used. So for example numbers, booleans, functions (the function's source will be used as the event name), etc. all work.

@@ -564,6 +572,7 @@ Returns a reference to the `EventEmitter`, so that calls can be chained.
<!-- YAML
added: v0.3.5
-->
- `n` {number}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it may make more sense to be more specific here and say 'integer.'

@mscdex
Copy link
Contributor

mscdex commented Mar 12, 2017

LGTM

jasnell pushed a commit that referenced this pull request Mar 15, 2017
Refs: #9399
PR-URL: #11802
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
@jasnell
Copy link
Member

jasnell commented Mar 15, 2017

Landed in 38ba0c2. Thank you! :-)

@jasnell jasnell closed this Mar 15, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Mar 20, 2017
Refs: nodejs#9399
PR-URL: nodejs#11802
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
jungx098 pushed a commit to jungx098/node that referenced this pull request Mar 21, 2017
Refs: nodejs#9399
PR-URL: nodejs#11802
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Brian White <[email protected]>
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. events Issues and PRs related to the events subsystem / EventEmitter.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants