on-object
Register many EventEmitter listeners at once using objects
Usage
npm install on-object
var EventEmitter = var emitter = emitteremitteremitter
Instantiation
You can just use this module as a replacement for the EventEmitter
class in the events
module:
var EventEmitter = var emitter =
You can also use it to wrap the methods of a pre-existing EventEmitter
:
var EventEmitter = var onObject = var emitter =
Rationale
This module is useful when you find yourself registering many event listeners at once and want the syntax to look a little less noisy.
For example, you might write something like this using the original API:
emitteremitteremitter
This module will let you do this:
emitter
Also, you can make it look especially nice with the ES6 object method syntax:
emitter