...

/

EventEmitter vs. Callbacks

EventEmitter vs. Callbacks

Learn about the difference between EventEmitter and callbacks in Observer pattern.

We'll cover the following...

A common dilemma when defining an asynchronous API is deciding whether to use an EventEmitter instance or simply accept a callback. The general differentiating rule is semantic: callbacks should be used when a result must be returned in an asynchronous way, while events should be used when there’s a need to communicate that something has happened.

But besides this simple principle, a lot of ...