Need help on implementation related to Inversify. I am creating a class which is extending EventEmitter from node. when I try to use inversify it says EventEmitter is not injectable. Following is the sample code
//Interface
export interface ISubscriber {
Connect(callback: Function);
on(event: string, listener: Function): this;
emit(event: string, ...args: any[]): boolean;
}
//Class
import {EventEmitter} from 'events';
@injectable()
class Subscriber extends EventEmitter implements ISubscriber {
logProvider: SCLogging.ILogger;
public constructor(
@inject(TYPES.ILogger) logProvider: SCLogging.ILogger,
@inject(TYPES.IConfig) config: IConfig
) {
super();
//Some Implementation
}
public Connect(callback) {
//Some Implementation
}
public on(event: string, listener: Function): this {
super.on(event, listener);
return this;
}
public emit(event: string, ...args: any[]): boolean {
return super.emit(event, ...args);
}
}
export { ISubscriber, Subscriber }
//Define Binding
kernel.bind<SCLogging.ILogger>(TYPES.ILogger).to(Logger);
kernel.bind<IConfig>(TYPES.IConfig).to(Config);
kernel.bind<ISubscriber>(TYPES.ISubscriber).to(Subscriber);
I get error
Error: Missing required @injectable annotation in: EventEmitter.