events2
ES2015 implementation of nodejs EventEmitter
Installation
npm install events2
Run Tests
npm test
What's different from core EventEmitter?
-
emitter.off([eventName, listener])
methodThis is an alias for core
emitter.removeListener
ANDemitter.removeAllListeners
. Removes all listeners, or those of the specified event, or specified listener. -
no
defaultMaxListeners
limit -
as a result – no
getMaxListners()
/setMaxListeners()
-
no
listeners()
andlistenersCount()
Notes
As event listeners storage is a Set()
, if you add same listener for same 'event'
repeatedly, listener will be called only once after 'event'
was emited (listener will be called as many times as it was added in nodejs core EventEmitter)