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.0 to 0.4.1

32

lib/Emitter.d.ts
export declare type EventMap = {
[eventName: string]: Array<unknown>;
};
export declare type NewListenerEventListener<Events extends EventMap> = Listener<[
export declare type InternalEventNames = 'newListener' | 'removeListener';
export declare type InternalListener<Events extends EventMap> = Listener<[
eventName: keyof Events,
listener: Listener<Array<unknown>>
]>;
export declare type RemoveListenerEventListener<Events extends EventMap> = Listener<[
eventName: keyof Events,
listener: Listener<Array<unknown>>
]>;
export declare type Listener<Data extends Array<unknown>> = (...data: Data) => void;

@@ -48,28 +45,23 @@ /**

emit<EventName extends keyof Events>(eventName: EventName, ...data: Events[EventName]): boolean;
addListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
addListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
on(eventName: 'removeListener', listener: RemoveListenerEventListener<Events>): this;
on(eventName: InternalEventNames, listener: InternalListener<Events>): this;
on<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
once(eventName: 'newListener', listener: NewListenerEventListener<Events>): this;
once(eventName: 'removeListener', listener: RemoveListenerEventListener<Events>): this;
once(eventName: InternalEventNames, listener: InternalListener<Events>): this;
once<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
prependListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
prependListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
prependOnceListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
prependOnceListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
removeListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
removeListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
/**
* Alias for `emitter.removeListener()`.
*
* @example
* emitter.off('hello', listener)
*/
off(eventName: InternalEventNames, listener: InternalListener<Events>): this;
off<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
removeAllListeners(eventName?: InternalEventNames): this;
removeAllListeners<EventName extends keyof Events>(eventName?: EventName): this;
/**
* Returns a copy of the array of listeners for the event named `eventName`.
*/
listeners(eventName: InternalEventNames): Array<Listener<any>>;
listeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
/**
* Returns the number of listeners listening to the event named `eventName`.
*/
listenerCount(eventName: InternalEventNames): number;
listenerCount<EventName extends keyof Events>(eventName: EventName): number;
rawListeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
}
{
"name": "strict-event-emitter",
"version": "0.4.0",
"version": "0.4.1",
"description": "Type-safe implementation of EventEmitter for browser and Node.js",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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