$ gnpm install listenercount
backwards compatible version of builtin events.listenercount
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.
var listenerCount = require('listenercount')
var EventEmitter = require('events').EventEmitter
var ee = new EventEmitter()
ee.on('event', function () {})
listenerCount(ee, 'event') // => 1
listenerCount(ee, 'foo') // => 0
listenerCount(ee : EventEmitter, eventName : String) => Number
Returns the number of listeners for a given eventName
on an EventEmitter.
$ npm install listenercount
From package root:
$ npm install
$ npm test
ISC. (c) MMXVI jden jason@denizac.org. See LICENSE.md
Copyright 2013 - present © cnpmjs.org | Home |