ensemble
Event listener orchestration. Makes it easy to bulk unbind listeners that were
set withing a context. This is especially useful for unmounting listeners in
React's componentWillUnmount
lifecycle event.
Installation
$ npm i --save ensemble
Overview
var Emitter = EventEmitter;var ensemble = ; /** * Wrap an event emitter. */ var emitter = ; /** * Attach listeners to the emitter. */ emitter; /** * Remove all listeners registered * in the wrapper from the emitter. */ emitter
API
var emitter = ensemble(Emitter)
Wrap an event emitter in an ensemble object.
var Emitter = EventEmitter;var ensemble = ; var myEmitter = ;
.on(event, cb)
Attach an event listener to the wrapped emitter. Behaves identical to Node's built in listener function.
myEmitter;
.removeListeners()
Remove all listeners that were attached within this context to the emitter.
myEmitter;