import chalk from 'chalk';
-import { waitForChargingStationEvents } from './ChargingStationUtils';
+import { waitChargingStationEvents } from './ChargingStationUtils';
import type { AbstractUIServer } from './ui-server/AbstractUIServer';
import { UIServerFactory } from './ui-server/UIServerFactory';
import { version } from '../../package.json' assert { type: 'json' };
)
);
await Promise.race([
- waitForChargingStationEvents(
+ waitChargingStationEvents(
this,
ChargingStationWorkerMessageEvents.stopped,
this.numberOfChargingStations
);
};
-export const waitForChargingStationEvents = async (
+export const waitChargingStationEvents = async (
emitter: EventEmitter,
event: ChargingStationWorkerMessageEvents,
eventsToWait: number
const moduleName = 'AbstractUIService';
export abstract class AbstractUIService {
- protected static readonly ProcedureNameToBroadCastChannelProcedureNameMap: Omit<
+ protected static readonly ProcedureNameToBroadCastChannelProcedureNameMapping: Omit<
Record<ProcedureName, BroadcastChannelProcedureName>,
| ProcedureName.START_SIMULATOR
| ProcedureName.STOP_SIMULATOR
): void {
this.sendBroadcastChannelRequest(
uuid,
- AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMap[
+ AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMapping[
procedureName
] as BroadcastChannelProcedureName,
payload
export class UIService001 extends AbstractUIService {
constructor(uiServer: AbstractUIServer) {
super(uiServer, ProtocolVersion['0.0.1']);
- for (const procedureName of Object.keys(
- AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMap
- ) as ProcedureName[]) {
+ for (const procedureName in AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMapping) {
this.requestHandlers.set(
- procedureName,
+ procedureName as ProcedureName,
this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
);
}