/** * `EventMap` is a utility type that defines the structure of the event map used by the `EventEmitter` class. * * @example * ```ts * type MyEvents = { * 'data': (payload: string) => void; * 'error': (error: Error) => void; * }; * * const emitter = new EventEmitter(); * emitter.on('data', (payload) => console.log(payload)); * emitter.emit('data', 'Hello, World!'); * ``` */ export type EventMap void)[]; }> = { [Event in keyof Events]: Events[Event]; }; /** * A simple event emitter implementation used internally by the thread pool classes to manage events such as worker creation, termination, and errors. * * When creating your own custom thread pool implementation by extending `AbstractThreadPool`, you should use this `EventEmitter` * to have an event system that is compatible with the rest of the library and can be listened to by users of your custom pool. * * @example * @see {@link AbstractThreadPool} for an example of how to use `EventEmitter` in a custom thread pool implementation. */ export declare class EventEmitter void)[]; }> { private readonly events; on(event: Event, listener: Events[Event][number]): void; off(event: Event, listener: Events[Event][number]): void; emit(event: Event, payload: Parameters[0]): void; once(event: Event, listener: Events[Event][number]): void; } export default EventEmitter;