A ton of libraries out there model “event emitting”:
https://github.com/HenrikJoreteg/wildemitter
These libraries all allow us to create some sort of emitter
object on which we can register and trigger custom events.
I’m not sure I get it.
It seems that everyone is shoving this emitter
into the global namespace (if it’s used all over an app, no big whoop). So if that’s the case, what do we need an emitter
for at all? We can just run addEventListener
and dispatchEvent
wherever we need to, and those events will be attached to window
. (I’m talking browser here, I don’t speak node.)