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

clarification: not EventEmitter but its instance #20537

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ myEmitter.emit('event');

The `eventEmitter.emit()` method allows an arbitrary set of arguments to be
passed to the listener functions. It is important to keep in mind that when an
ordinary listener function is called by the `EventEmitter`, the standard `this`
keyword is intentionally set to reference the `EventEmitter` to which the
ordinary listener function is called, the standard `this`
keyword is intentionally set to reference the `EventEmitter` instance to which the
Copy link
Contributor

Choose a reason for hiding this comment

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

This line needs to be wrapped maximum at 80 characters to pass doc linting.

listener is attached.

```js
const myEmitter = new MyEmitter();
myEmitter.on('event', function(a, b) {
console.log(a, b, this);
console.log(a, b, this, this === myEmitter);
// Prints:
// a b MyEmitter {
// domain: null,
// _events: { event: [Function] },
// _eventsCount: 1,
// _maxListeners: undefined }
// _maxListeners: undefined } true
});
myEmitter.emit('event', 'a', 'b');
```
Expand Down