Design Patterns · Junior · Question 48 of 75

Which pattern does EventEmitter in Node.js or EventTarget in the browser implement?

Explanation

The object keeps lists of handlers by event name and calls them on emit/dispatchEvent. Subscribing is on/addEventListener, unsubscribing is off/removeEventListener.

Further reading

Problem with a question

Design Patterns · Junior · question 48

Test yourself

Take the Design Patterns · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz