import EventEmitter from 'events'; namespace ImplementableApi { export type Config = { name: string; }; /** * [optional] idListener is the way to identificate the listener who's the src of the newEntries * the type field permit to know which type of message it is * rawContent field is the string content of the message */ export type Message = { idListener?: number; type: T | 'logging'; rawContent: any; }; export type TBaseMessageType = string; } abstract class ImplementableApi< T extends ImplementableApi.TBaseMessageType > extends EventEmitter { readonly name: string; constructor(readonly config: ImplementableApi.Config) { super(); this.name = config.name; } public abstract receivedMessage(message: ImplementableApi.Message): void; } export { ImplementableApi };