/**
 * @license MIT
 * @copyright Copyright (c) 2026, GoldFrite
 */
import { EventEmitter as EM } from 'node:events';
export default class EventEmitter {
    constructor() {
        this.emitter = new EM();
    }
    /**
     * Add a listener for the given event.
     * @param eventName The name of the event.
     * @param listener The callback function.
     * @returns This EventEmitter instance.
     */
    on(eventName, listener) {
        this.emitter.on(eventName, listener);
        return this;
    }
    /**
     * Forward all events emitted by this EventEmitter to another EventEmitter.
     * @param target The target EventEmitter to forward events to (usually `this`).
     */
    forwardEvents(target) {
        const originalEmit = this.emit;
        this.emit = (event, ...args) => {
            target.emit(event, ...args);
            return originalEmit.apply(this, [event, ...args]);
        };
    }
    /**
     * Emit an event with the given arguments.
     * @param eventName The name of the event.
     * @param args The arguments to pass to the listeners.
     * @returns `true` if the event had listeners, `false` otherwise.
     */
    emit(eventName, ...args) {
        return this.emitter.emit(eventName, ...args);
    }
}
//# sourceMappingURL=events.js.map