nope/lib/communication/eventLayer.ts
Martin Karkowski 292d156583 dispatcher
2020-08-21 18:38:21 +02:00

12 lines
397 B
TypeScript

import { EventEmitter } from "events";
import { CommunicationEvents, ICommunicationInterface } from "../callDispatcher";
export class EventLayer implements ICommunicationInterface {
protected _emitter = new EventEmitter();
on(event: CommunicationEvents, cb: (...args: any[]) => void) {
this._emitter.on(event, cb);
}
send(data: any): void {
this._emitter.emit('event', data)
}
}