strict-event-emitter
Advanced tools
Comparing version 0.4.4 to 0.4.5
@@ -21,3 +21,3 @@ export declare type EventMap = { | ||
private maxListeners; | ||
private hasWarnedAboutPotentialMemortyLeak; | ||
private hasWarnedAboutPotentialMemoryLeak; | ||
static defaultMaxListeners: number; | ||
@@ -34,3 +34,3 @@ static listenerCount<Events extends EventMap>(emitter: Emitter<EventMap>, eventName: keyof Events): number; | ||
* either set by `emitter.setMaxListeners(n)` or defaults to | ||
* `Emitteer.defaultMaxListeners`. | ||
* `Emitter.defaultMaxListeners`. | ||
*/ | ||
@@ -37,0 +37,0 @@ getMaxListeners(): number; |
@@ -16,3 +16,3 @@ "use strict"; | ||
maxListeners; | ||
hasWarnedAboutPotentialMemortyLeak; | ||
hasWarnedAboutPotentialMemoryLeak; | ||
static defaultMaxListeners = 10; | ||
@@ -25,3 +25,3 @@ static listenerCount(emitter, eventName) { | ||
this.maxListeners = Emitter.defaultMaxListeners; | ||
this.hasWarnedAboutPotentialMemortyLeak = false; | ||
this.hasWarnedAboutPotentialMemoryLeak = false; | ||
} | ||
@@ -57,3 +57,3 @@ _emitInternalEvent(internalEventName, eventName, listener) { | ||
* either set by `emitter.setMaxListeners(n)` or defaults to | ||
* `Emitteer.defaultMaxListeners`. | ||
* `Emitter.defaultMaxListeners`. | ||
*/ | ||
@@ -93,4 +93,4 @@ getMaxListeners() { | ||
this.listenerCount(eventName) > this.maxListeners && | ||
!this.hasWarnedAboutPotentialMemortyLeak) { | ||
this.hasWarnedAboutPotentialMemortyLeak = true; | ||
!this.hasWarnedAboutPotentialMemoryLeak) { | ||
this.hasWarnedAboutPotentialMemoryLeak = true; | ||
const memoryLeakWarning = new MemoryLeakError_1.MemoryLeakError(this, eventName, this.listenerCount(eventName)); | ||
@@ -97,0 +97,0 @@ console.warn(memoryLeakWarning); |
{ | ||
"name": "strict-event-emitter", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "Type-safe implementation of EventEmitter for browser and Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -18,3 +18,3 @@ # Strict Event Emitter | ||
// We can, however, emit a different event by mistake. | ||
emitter.emit('poing', 1) | ||
emitter.emit('pong', 1) | ||
@@ -74,3 +74,3 @@ // Or even the correct event with the wrong data. | ||
// 3. Use the "emitter" the same way you'd use the regular "EventEmitter" instance. | ||
emitter.addListner('connect', (id) => {}) | ||
emitter.addListener('connect', (id) => {}) | ||
emitter.emit('connect', 'abc-123') | ||
@@ -77,0 +77,0 @@ ``` |
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
14349