"use strict";
/*import { EventEmitter } from 'events';

import { forEach } from '@f2/object';

import { DoneErrorEvent } from './done-error-event.js';


export type WireEventFunction = (event: DoneErrorEvent<any, any>, ...args: any[]) => void;

export interface WireEventBind<TObject> {
    object: TObject;
    method: keyof TObject;
}

export interface WireEventDefinitionMap {
    [key: string]: WireEventFunction | undefined
}

export type WireEventDefinition<TMap extends WireEventDefinitionMap> = {
    [P in keyof TMap]: TMap[P] | WireEventBind<any>
}

export interface WireEventEmitter<TMap extends WireEventDefinitionMap> extends EventEmitter {
    emit(eventName: keyof TMap | string | symbol, event: DoneErrorEvent<any, any>, ...args: any[]): boolean;
}

export function getWireEventEmitter<TEmitter extends WireEventEmitter<any>>(definition: WireEventDefinition<any> | TEmitter): TEmitter {

    if(definition instanceof EventEmitter) {
        return definition;
    }

    let eventEmitter = new EventEmitter();

    forEach(definition, (eventName, _function: WireEventFunction | WireEventBind<any>) => {

        let __function: (...args: any[]) => void;

        if(typeof _function === 'function') {
            __function = _function;
        } else {
            __function = _function.object[_function.method].bind(_function.object);
        }

        eventEmitter.on(<string>eventName, __function);
    });

    return <TEmitter>eventEmitter;
}*/ 
