Comparing version 1.0.0 to 1.0.1
@@ -25,5 +25,5 @@ import { EventName, ListenerFunction } from './lib/interface'; | ||
* @param {number} maxListeners - The number of max listeners. | ||
* @return {number} | ||
* @return {EventEmitter} | ||
*/ | ||
setMaxListeners(maxListeners: number): void; | ||
setMaxListeners(maxListeners: number): EventEmitter; | ||
/** | ||
@@ -30,0 +30,0 @@ * Returns an array listing the events for which the emitter |
@@ -14,3 +14,3 @@ // The EventEmitter instance will emit its own 'newListener' | ||
if (!isValid) { | ||
console.warn("the type of 'listener' is not valid"); | ||
throw new TypeError("[events] the type of 'listener' is not valid"); | ||
} | ||
@@ -22,3 +22,3 @@ return isValid; | ||
if (!isValid) { | ||
console.warn("the type of 'eventName' is not valid"); | ||
throw new TypeError("[events] the type of 'eventName' is not valid"); | ||
} | ||
@@ -112,9 +112,10 @@ return isValid; | ||
* @param {number} maxListeners - The number of max listeners. | ||
* @return {number} | ||
* @return {EventEmitter} | ||
*/ | ||
EventEmitter.prototype.setMaxListeners = function (maxListeners) { | ||
if (!isPositiveNumber(maxListeners)) { | ||
throw new TypeError('MaxListeners number must be a positive number!'); | ||
throw new TypeError('[events] MaxListeners number must be a positive number!'); | ||
} | ||
this._maxListeners = maxListeners; | ||
return this; | ||
}; | ||
@@ -311,5 +312,6 @@ /** | ||
var length_1 = _events[eventName].length; | ||
_res = length_1 >= this._maxListeners; | ||
_res = length_1 > this._maxListeners; | ||
if (_res) { | ||
console.warn("\n The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of \n the existence of possible EventEmitter memory leak!\n "); | ||
/* istanbul ignore next */ | ||
throw new RangeError("\n [events] The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of the \n existence of possible EventEmitter memory leak!\n "); | ||
} | ||
@@ -356,3 +358,4 @@ } | ||
if (!isValidEventName(eventName) || !isValidListener(listener)) { | ||
throw new TypeError('[_addListener] invalid arguments!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError("[events] Invalid arguments of 'eventName' or 'listener'!"); | ||
} | ||
@@ -364,3 +367,4 @@ var _events = this._getEvents(); | ||
if (!isArray(_events[eventName])) { | ||
throw new TypeError('[_addListener] events[eventName] must be array!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError('[events] The events[eventName] must be array type!'); | ||
} | ||
@@ -367,0 +371,0 @@ var prependMethod = prepend ? 'unshift' : 'push'; |
@@ -20,3 +20,3 @@ (function (global, factory) { | ||
if (!isValid) { | ||
console.warn("the type of 'listener' is not valid"); | ||
throw new TypeError("[events] the type of 'listener' is not valid"); | ||
} | ||
@@ -28,3 +28,3 @@ return isValid; | ||
if (!isValid) { | ||
console.warn("the type of 'eventName' is not valid"); | ||
throw new TypeError("[events] the type of 'eventName' is not valid"); | ||
} | ||
@@ -118,9 +118,10 @@ return isValid; | ||
* @param {number} maxListeners - The number of max listeners. | ||
* @return {number} | ||
* @return {EventEmitter} | ||
*/ | ||
EventEmitter.prototype.setMaxListeners = function (maxListeners) { | ||
if (!isPositiveNumber(maxListeners)) { | ||
throw new TypeError('MaxListeners number must be a positive number!'); | ||
throw new TypeError('[events] MaxListeners number must be a positive number!'); | ||
} | ||
this._maxListeners = maxListeners; | ||
return this; | ||
}; | ||
@@ -317,5 +318,6 @@ /** | ||
var length_1 = _events[eventName].length; | ||
_res = length_1 >= this._maxListeners; | ||
_res = length_1 > this._maxListeners; | ||
if (_res) { | ||
console.warn("\n The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of \n the existence of possible EventEmitter memory leak!\n "); | ||
/* istanbul ignore next */ | ||
throw new RangeError("\n [events] The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of the \n existence of possible EventEmitter memory leak!\n "); | ||
} | ||
@@ -362,3 +364,4 @@ } | ||
if (!isValidEventName(eventName) || !isValidListener(listener)) { | ||
throw new TypeError('[_addListener] invalid arguments!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError("[events] Invalid arguments of 'eventName' or 'listener'!"); | ||
} | ||
@@ -370,3 +373,4 @@ var _events = this._getEvents(); | ||
if (!isArray(_events[eventName])) { | ||
throw new TypeError('[_addListener] events[eventName] must be array!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError('[events] The events[eventName] must be array type!'); | ||
} | ||
@@ -373,0 +377,0 @@ var prependMethod = prepend ? 'unshift' : 'push'; |
@@ -43,9 +43,10 @@ 'use strict'; | ||
* @param {number} maxListeners - The number of max listeners. | ||
* @return {number} | ||
* @return {EventEmitter} | ||
*/ | ||
EventEmitter.prototype.setMaxListeners = function (maxListeners) { | ||
if (!utils_1.isPositiveNumber(maxListeners)) { | ||
throw new TypeError('MaxListeners number must be a positive number!'); | ||
throw new TypeError('[events] MaxListeners number must be a positive number!'); | ||
} | ||
this._maxListeners = maxListeners; | ||
return this; | ||
}; | ||
@@ -242,5 +243,6 @@ /** | ||
var length_1 = _events[eventName].length; | ||
_res = length_1 >= this._maxListeners; | ||
_res = length_1 > this._maxListeners; | ||
if (_res) { | ||
console.warn("\n The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of \n the existence of possible EventEmitter memory leak!\n "); | ||
/* istanbul ignore next */ | ||
throw new RangeError("\n [events] The current event " + eventName + "(" + length_1 + ") has exceeded the maximum \n number of listeners(" + this._maxListeners + "), You need to be aware of the \n existence of possible EventEmitter memory leak!\n "); | ||
} | ||
@@ -287,3 +289,4 @@ } | ||
if (!utils_1.isValidEventName(eventName) || !utils_1.isValidListener(listener)) { | ||
throw new TypeError('[_addListener] invalid arguments!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError("[events] Invalid arguments of 'eventName' or 'listener'!"); | ||
} | ||
@@ -295,3 +298,4 @@ var _events = this._getEvents(); | ||
if (!utils_1.isArray(_events[eventName])) { | ||
throw new TypeError('[_addListener] events[eventName] must be array!'); | ||
/* istanbul ignore next */ | ||
throw new TypeError('[events] The events[eventName] must be array type!'); | ||
} | ||
@@ -298,0 +302,0 @@ var prependMethod = prepend ? 'unshift' : 'push'; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
if (!isValid) { | ||
console.warn("the type of 'listener' is not valid"); | ||
throw new TypeError("[events] the type of 'listener' is not valid"); | ||
} | ||
@@ -15,3 +15,3 @@ return isValid; | ||
if (!isValid) { | ||
console.warn("the type of 'eventName' is not valid"); | ||
throw new TypeError("[events] the type of 'eventName' is not valid"); | ||
} | ||
@@ -18,0 +18,0 @@ return isValid; |
@@ -25,5 +25,5 @@ import { EventName, ListenerFunction } from './lib/interface'; | ||
* @param {number} maxListeners - The number of max listeners. | ||
* @return {number} | ||
* @return {EventEmitter} | ||
*/ | ||
setMaxListeners(maxListeners: number): void; | ||
setMaxListeners(maxListeners: number): EventEmitter; | ||
/** | ||
@@ -30,0 +30,0 @@ * Returns an array listing the events for which the emitter |
{ | ||
"name": "tp-events", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Used to obtain the current events parameters and configuration", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2611381
2768