eventemitter3
Advanced tools
Comparing version 1.1.1 to 1.2.0
37
index.js
'use strict'; | ||
var has = Object.prototype.hasOwnProperty; | ||
// | ||
@@ -18,3 +20,3 @@ // We store our EE objects in a plain object whose properties are event names. | ||
* @param {Mixed} context Context for function execution. | ||
* @param {Boolean} once Only emit once | ||
* @param {Boolean} [once=false] Only emit once | ||
* @api private | ||
@@ -38,3 +40,3 @@ */ | ||
/** | ||
* Holds the assigned EventEmitters by name. | ||
* Hold the assigned EventEmitters by name. | ||
* | ||
@@ -47,2 +49,27 @@ * @type {Object} | ||
/** | ||
* Return an array listing the events for which the emitter has registered | ||
* listeners. | ||
* | ||
* @returns {Array} | ||
* @api public | ||
*/ | ||
EventEmitter.prototype.eventNames = function eventNames() { | ||
var events = this._events | ||
, names = [] | ||
, name; | ||
if (!events) return names; | ||
for (name in events) { | ||
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); | ||
} | ||
if (Object.getOwnPropertySymbols) { | ||
return names.concat(Object.getOwnPropertySymbols(events)); | ||
} | ||
return names; | ||
}; | ||
/** | ||
* Return a list of assigned event listeners. | ||
@@ -132,4 +159,4 @@ * | ||
* @param {String} event Name of the event. | ||
* @param {Functon} fn Callback function. | ||
* @param {Mixed} context The context of the function. | ||
* @param {Function} fn Callback function. | ||
* @param {Mixed} [context=this] The context of the function. | ||
* @api public | ||
@@ -158,3 +185,3 @@ */ | ||
* @param {Function} fn Callback function. | ||
* @param {Mixed} context The context of the function. | ||
* @param {Mixed} [context=this] The context of the function. | ||
* @api public | ||
@@ -161,0 +188,0 @@ */ |
{ | ||
"name": "eventemitter3", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test-browser": "zuul --browser-name ${BROWSER_NAME} --browser-version ${BROWSER_VERSION} -- test.js", | ||
"test-node": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- test.js", | ||
"coverage": "istanbul cover ./node_modules/.bin/_mocha -- test.js", | ||
"test-node": "istanbul cover _mocha --report lcovonly -- test.js", | ||
"coverage": "istanbul cover _mocha -- test.js", | ||
"test-browser": "zuul -- test.js", | ||
"sync": "node versions.js", | ||
@@ -41,8 +41,8 @@ "test": "mocha test.js" | ||
"devDependencies": { | ||
"assume": "1.2.x", | ||
"istanbul": "0.3.x", | ||
"mocha": "2.2.x", | ||
"pre-commit": "1.0.x", | ||
"zuul": "3.0.x" | ||
"assume": "1.3.x", | ||
"istanbul": "0.4.x", | ||
"mocha": "2.4.x", | ||
"pre-commit": "1.1.x", | ||
"zuul": "3.10.x" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13619
245