repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: remove uneeded unknown intermediate type cast
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
broadcast-channel
/
UIServiceWorkerBroadcastChannel.ts
diff --git
a/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
b/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
index 89058cebd1b79337ec3f0a9ef7be7852f78d0f51..b385be7fc47aae52e67eaac792dc4f59256c81a1 100644
(file)
--- a/
src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
+++ b/
src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
@@
-11,11
+11,11
@@
import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIServi
const moduleName = 'UIServiceWorkerBroadcastChannel';
const moduleName = 'UIServiceWorkerBroadcastChannel';
-
type Responses =
{
+
interface Responses
{
responsesExpected: number;
responsesReceived: number;
responses: BroadcastChannelResponsePayload[];
responsesExpected: number;
responsesReceived: number;
responses: BroadcastChannelResponsePayload[];
-}
;
+}
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
private readonly uiService: AbstractUIService;
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
private readonly uiService: AbstractUIService;
@@
-24,8
+24,8
@@
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
constructor(uiService: AbstractUIService) {
super();
this.uiService = uiService;
constructor(uiService: AbstractUIService) {
super();
this.uiService = uiService;
- this.onmessage = this.responseHandler.bind(this) as (message:
MessageEvent
) => void;
- this.onmessageerror = this.messageErrorHandler.bind(this) as (message:
MessageEvent
) => void;
+ this.onmessage = this.responseHandler.bind(this) as (message:
unknown
) => void;
+ this.onmessageerror = this.messageErrorHandler.bind(this) as (message:
unknown
) => void;
this.responses = new Map<string, Responses>();
}
this.responses = new Map<string, Responses>();
}
@@
-45,9
+45,9
@@
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
responses: [responsePayload],
});
} else if (
responses: [responsePayload],
});
} else if (
- this.responses.get(uuid)
?.responsesReceived <= this.responses.get(uuid)?
.responsesExpected
+ this.responses.get(uuid)
!.responsesReceived <= this.responses.get(uuid)!
.responsesExpected
) {
) {
- ++this.responses.get(uuid).responsesReceived;
+ ++this.responses.get(uuid)
!
.responsesReceived;
this.responses.get(uuid)?.responses.push(responsePayload);
}
if (
this.responses.get(uuid)?.responses.push(responsePayload);
}
if (
@@
-75,7
+75,7
@@
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
if (status === ResponseStatus.SUCCESS) {
return hashId;
}
if (status === ResponseStatus.SUCCESS) {
return hashId;
}
- }),
+ })
as string[]
,
...(responsesStatus === ResponseStatus.FAILURE && {
hashIdsFailed: this.responses
.get(uuid)
...(responsesStatus === ResponseStatus.FAILURE && {
hashIdsFailed: this.responses
.get(uuid)
@@
-84,7
+84,7
@@
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
if (status === ResponseStatus.FAILURE) {
return hashId;
}
if (status === ResponseStatus.FAILURE) {
return hashId;
}
- }),
+ })
as string[]
,
}),
...(responsesStatus === ResponseStatus.FAILURE && {
responsesFailed: this.responses
}),
...(responsesStatus === ResponseStatus.FAILURE && {
responsesFailed: this.responses
@@
-94,7
+94,7
@@
export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
if (response.status === ResponseStatus.FAILURE) {
return response;
}
if (response.status === ResponseStatus.FAILURE) {
return response;
}
- }),
+ })
as BroadcastChannelResponsePayload[]
,
}),
};
}
}),
};
}