Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strict-event-emitter

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strict-event-emitter - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

4

lib/Emitter.d.ts

@@ -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 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc