events2

1.1.0 • Public • Published

events2 Build Status

ES2015 implementation of nodejs EventEmitter

Installation

npm install events2

Run Tests

npm test

What's different from core EventEmitter?

  • emitter.off([eventName, listener]) method

    This is an alias for core emitter.removeListener AND emitter.removeAllListeners. Removes all listeners, or those of the specified event, or specified listener.

  • no defaultMaxListeners limit

  • as a result – no getMaxListners()/setMaxListeners()

  • no listeners() and listenersCount()

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)

Package Sidebar

Install

npm i events2

Weekly Downloads

3

Version

1.1.0

License

MIT

Last publish

Collaborators

  • lesnitsky