Skip to content

Commit

Permalink
doc: update output of example in events.getEventListeners
Browse files Browse the repository at this point in the history
Update mismatched output of `events.getEventListeners` example.
Plus, show output using console.log.

PR-URL: #46268
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
deokjinkim authored and juanarbol committed Mar 5, 2023
1 parent f328f7b commit 5adb743
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -1232,13 +1232,13 @@ import { getEventListeners, EventEmitter } from 'node:events';
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
getEventListeners(ee, 'foo'); // [listener]
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
getEventListeners(et, 'foo'); // [listener]
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
```

Expand All @@ -1249,13 +1249,13 @@ const { getEventListeners, EventEmitter } = require('node:events');
const ee = new EventEmitter();
const listener = () => console.log('Events are fun');
ee.on('foo', listener);
getEventListeners(ee, 'foo'); // [listener]
console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ]
}
{
const et = new EventTarget();
const listener = () => console.log('Events are fun');
et.addEventListener('foo', listener);
getEventListeners(et, 'foo'); // [listener]
console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ]
}
```

Expand Down

0 comments on commit 5adb743

Please sign in to comment.