backwards compatible version of builtin events.listenercount
npm install listenercount![build status][circleci]
[circleci]: https://circleci.com/gh/jden/node-listenercount
[standard]: http://standardjs.com/
A polyfill of Node.js 0.12+'s events.listenerCount function for Node.js 0.10. Uses the builtin if present, otherwise uses polyfill implementation.
js
var listenerCount = require('listenercount')
var EventEmitter = require('events').EventEmittervar ee = new EventEmitter()
ee.on('event', function () {})
listenerCount(ee, 'event') // => 1
listenerCount(ee, 'foo') // => 0
`
api
$3
Returns the number of listeners for a given eventName` on an EventEmitter.$ npm install listenercount
From package root:
$ npm install
$ npm test
- jden
ISC. (c) MMXVI jden