UNPKG

@glandjs/emitter

Version:

A fast, zero‑dependency event emitter for building scalable, event‑driven applications.

13 lines (12 loc) 493 B
export declare class EventEmitter<T = Record<string, any>> { private spliter; private maxCacheSize; private tree; private cache; private id; constructor(spliter?: string, maxCacheSize?: number); on<K extends keyof T & string>(event: K, listener: (payload: T[K]) => void): this; off<K extends keyof T & string>(event: K, listener?: (payload: T[K]) => void): this; emit<K extends keyof T & string>(event: K, payload: T[K]): this; private findListeners; }