Sha256: d3bd0cd9e280c9b23d5203237d555044265c7c904bf91287aa76da734428fb9a

Contents?: true

Size: 1.65 KB

Versions: 32

Compression:

Stored size: 1.65 KB

Contents

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

require('./common');
var assert = require('assert');
var EventEmitter = require('../');

var emitter = new EventEmitter();
emitter.on('foo', function() {});
emitter.on('foo', function() {});
emitter.on('baz', function() {});
// Allow any type
emitter.on(123, function() {});

assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2);
assert.strictEqual(emitter.listenerCount('foo'), 2);
assert.strictEqual(emitter.listenerCount('bar'), 0);
assert.strictEqual(emitter.listenerCount('baz'), 1);
assert.strictEqual(emitter.listenerCount(123), 1);

Version data entries

32 entries across 31 versions & 10 rubygems

Version Path
tang-0.0.9 spec/tang_app/node_modules/events/tests/listener-count.js
enju_library-0.3.8 spec/dummy/node_modules/events/tests/listener-count.js
ilog-0.4.1 node_modules/events/tests/listener-count.js
ilog-0.4.0 node_modules/events/tests/listener-count.js
ilog-0.3.3 node_modules/events/tests/listener-count.js
jester-data-8.0.0 node_modules/events/tests/listener-count.js
ezii-os-5.2.1 node_modules/events/tests/listener-count.js
ezii-os-2.0.1 node_modules/events/tests/listener-count.js
ezii-os-1.1.0 node_modules/events/tests/listener-count.js
ezii-os-1.0.0 node_modules/events/tests/listener-count.js
ezii-os-0.0.0.1.0 node_modules/events/tests/listener-count.js
ezii-os-0.0.0.0.1 node_modules/events/tests/listener-count.js