From 5adb74351137dd9ceb7f9ca9fea0389f2059e5e4 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Sat, 21 Jan 2023 19:39:54 +0900 Subject: [PATCH] doc: update output of example in `events.getEventListeners` Update mismatched output of `events.getEventListeners` example. Plus, show output using console.log. PR-URL: https://github.com/nodejs/node/pull/46268 Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/events.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/events.md b/doc/api/events.md index 7fe87d037e76ea..6f6f0d091872d1 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -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] ] } ``` @@ -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] ] } ```