Adding extra ICommunicationMirror

This commit is contained in:
Martin Karkowski 2021-03-22 20:24:27 +01:00
parent 612bbcadb8
commit 5ebc22488c

View File

@ -309,14 +309,74 @@ export interface ICommunicationBridge extends ICommunicationInterface {
layer: ICommunicationInterface,
forwardData?: boolean,
considerConnection?: boolean
): void;
): Promise<void>;
/**
* Function, to remove the Layer again.
*
* @param {ICommunicationInterface} layer The Layer to Remove
* @memberof ICommunicationBridge
*/
removeLayer(layer: ICommunicationInterface): void;
removeLayer(layer: ICommunicationInterface): Promise<void>;
addMirror(mirror: IEmitter, addSubscriptions?: boolean): void;
removeMirror(mirror: IEmitter): boolean;
}
export type ValidEventTypesOfMirror =
// Default emitters
| "aurevoir"
| "bonjour"
| "NewInstanceGeneratorsAvailable"
| "NewInstancesAvailable"
| "NewObersvablesAvailable"
| "NewServicesAvailable"
| "StatusUpdate"
| "TaskCancelation"
| "event"
| "rpcRequest"
| "rpcResponse";
export const ValidEventTypesOfMirror = [
// Default emitters
"aurevoir",
"bonjour",
"NewInstanceGeneratorsAvailable",
"NewInstancesAvailable",
"NewObersvablesAvailable",
"NewServicesAvailable",
"StatusUpdate",
"TaskCancelation",
"event",
"rpcRequest",
"rpcResponse"
];
export interface ICommunicationMirror {
/**
* Function, used to subscribe to a specific Event
*
* @param {(ValidEventTypesOfMirror | symbol)} event The Name of the Event
* @param {(...args: any[]) => void} listener The callback.
* @memberof ICommunicationMirror
*/
on(
event: ValidEventTypesOfMirror | symbol,
listener: (...args: any[]) => void
): void;
/**
* Helper to emitt an event.
*
* @param {ValidEventTypesOfMirror} event
* @param {*} data
* @memberof ICommunicationMirror
*/
emit(event: ValidEventTypesOfMirror, data: any): void;
/**
* Flag, indication, whether the Layer is connected or not.
*/
connected: INopeObservable<boolean>;
}
export type ITaskCancelationMsg = {