diff --git a/lib/communication/eventLayer.ts b/lib/communication/eventLayer.ts index 3c02fc6..69d7801 100644 --- a/lib/communication/eventLayer.ts +++ b/lib/communication/eventLayer.ts @@ -16,6 +16,7 @@ import { IAvailableServicesMsg, IAvailableTopicsMsg, ICommunicationInterface, + IEmitter, IExternalEventMsg, IRequestTaskMsg, IResponseTaskMsg, @@ -24,14 +25,6 @@ import { import { IDispatcherInfo } from "../types/nope/nopeDispatcher.interface"; import { INopeObservable } from "../types/nope/nopeObservable.interface"; -export interface IEmitter { - on(event: string | symbol, listener: (...args: any[]) => void): this; - off(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - getMaxListeners?: () => number; - setMaxListeners?: (n: number) => void; -} - /** * A Communication Layer for the Dispatchers. * Here, only a Events are used. @@ -43,7 +36,7 @@ export interface IEmitter { export class EventLayer implements ICommunicationInterface { connected: INopeObservable; considerConnection = true; - allowServiceRedundancy = false + allowServiceRedundancy = false; /** * Creaetes an Event Emitter-based Communication Layer: @@ -58,7 +51,7 @@ export class EventLayer implements ICommunicationInterface { this.connected.setContent(true); this.id = generateId(); } - + id: string; protected _on(event: string, cb) { @@ -204,7 +197,7 @@ export class EventLayer implements ICommunicationInterface { this._emitter.off("event_" + event, cb); } - async dispose(){ + async dispose(): Promise { this.connected.dispose(); } }