strict-event-emitter
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -1,1 +0,1 @@ | ||
export { StrictEventEmitter } from './StrictEventEmitter'; | ||
export * from './StrictEventEmitter'; |
@@ -9,5 +9,6 @@ "use strict"; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
exports.__esModule = true; | ||
exports.StrictEventEmitter = void 0; | ||
var StrictEventEmitter_1 = require("./StrictEventEmitter"); | ||
__createBinding(exports, StrictEventEmitter_1, "StrictEventEmitter"); | ||
__exportStar(require("./StrictEventEmitter"), exports); |
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
export declare class StrictEventEmitter<EventMap extends Record<string | symbol, any>> extends EventEmitter { | ||
export declare type EventMapType = Record<string | symbol, any>; | ||
export declare class StrictEventEmitter<EventMap extends EventMapType> extends EventEmitter { | ||
constructor(); | ||
on<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
once<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
off<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
emit<K extends keyof EventMap>(event: K, ...data: Parameters<EventMap[K]>): boolean; | ||
addListener<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
prependListener<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
prependOnceListener<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
removeListener<K extends keyof EventMap>(event: K, listener: EventMap[K]): this; | ||
eventNames(): Array<keyof EventMap>; | ||
listeners<K extends keyof EventMap>(event: K): Array<EventMap[K]>; | ||
rawListeners<K extends keyof EventMap>(event: K): Array<EventMap[K]>; | ||
listenerCount<K extends keyof EventMap>(event: K): number; | ||
on<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
once<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
off<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
emit<Event extends keyof EventMap>(event: Event, ...data: Parameters<EventMap[Event]>): boolean; | ||
addListener<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
prependListener<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
prependOnceListener<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
removeListener<Event extends keyof EventMap>(event: Event, listener: EventMap[Event]): this; | ||
removeAllListeners<Event extends keyof EventMap>(event?: Event): this; | ||
eventNames<Event extends keyof EventMap>(): Event[]; | ||
listeners<Event extends keyof EventMap>(event: Event): Array<EventMap[Event]>; | ||
rawListeners<Event extends keyof EventMap>(event: Event): Array<EventMap[Event]>; | ||
listenerCount<Event extends keyof EventMap>(event: Event): number; | ||
} |
@@ -58,3 +58,5 @@ "use strict"; | ||
}; | ||
// @ts-ignore Cannot cast a narrower return type. | ||
StrictEventEmitter.prototype.removeAllListeners = function (event) { | ||
return _super.prototype.removeAllListeners.call(this, event ? event.toString() : undefined); | ||
}; | ||
StrictEventEmitter.prototype.eventNames = function () { | ||
@@ -61,0 +63,0 @@ return _super.prototype.eventNames.call(this); |
{ | ||
"name": "strict-event-emitter", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Type-safe \"EventEmitter\" for everyday use", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
8530
108