Skip to content

MaxListenersExceededWarning and EventTarget #4766

Answered by jasnell
noseratio asked this question in Q&A
Discussion options

You must be logged in to vote

See: https://nodejs.org/dist/latest-v15.x/docs/api/events.html#events_eventemitter_setmaxlisteners_n_eventtargets

const {
  setMaxListeners,
  EventEmitter
} = require('events');

const target = new EventTarget();
const emitter = new EventEmitter();

setMaxListeners(5, target, emitter);

Replies: 0 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@noseratio
Comment options

Answer selected by noseratio
Comment options

You must be logged in to vote
2 replies
@fawazahmed0
Comment options

@newTomas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants