Define EventEmitter listeners on a class instead of each individual instance
Define EventEmitter listeners on a class to save on memory consumption in exchange for a little bit of extra work emitting the events themselves.
Suitable when you've got a lot of mostly similar EventEmitters, and you're not emitting enough events for it to be a performance bottleneck.
See also: bindle
Returns a new
prototype-emitter class. Optionally you can pass a
in as the first argument to mixin
Once created or mixed in, you can add event listeners directly on the
class before (or after) creating instances of it. These listeners will
be available on each instance, so calling
ee.emit will trigger these
var PrototypeEmitter =var CustomEmitter =CustomEmitterCustomEmittervar emitter =emitteremitteremitteremitter// data recieved:// >> 1// > 1// >> 2// > 2// >> 3// > 3
MIT. See LICENSE.md for details.