Consider I want to use EventEmitter2
, or some implementation of EventEmitter
of my own. However, if I just do EventEmitter = MyEventEmitter
, it only helps for explicit inheritance that happens after this declaration, but obviously won't change existing objects inheriting from builtin EventEmitter
, and is limited to scope of module.
Can I take advantage of alternative EventEmitter
s when using builtin objects? I can think of just descending prototype chain of any particular object, and if prototype appears to be instance of EventEmitter
, replace it with my own, but isn't there more elegant way?