Generalized, minimal implementation of a container that
holds callbacks, and can emit values to them.
This implementation does not accept "named" events like emitter.on('error', function (err) {...}),
and as a consequence is drastically more simple / compact / efficient than other event emitter implementations.
In general, rather than smashing multiple "named" events onto one emitter,
just make multiple emitter instances instead.
Generalized, minimal implementation of a container that holds callbacks, and can emit values to them.
This implementation does not accept "named" events like
emitter.on('error', function (err) {...})
, and as a consequence is drastically more simple / compact / efficient than other event emitter implementations.In general, rather than smashing multiple "named" events onto one emitter, just make multiple emitter instances instead.
For Example:
emitter.on('next', ...)
-> onNext: EventEmitteremitter.on('done', ...)
-> onDone: EventEmitteremitter.on('error', ...)
-> onError: EventEmitter