Simplify BroadcastChannel classes inheritance
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 23 Aug 2022 12:48:40 +0000 (14:48 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 23 Aug 2022 12:48:40 +0000 (14:48 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorkerBroadcastChannel.ts

index 5115d6cf7e99bb6f0114690aeb48b95f0c063a71..edb7475a097c522f4f76a1038a7a69342959cd42 100644 (file)
@@ -1,5 +1,3 @@
-import { BroadcastChannel } from 'worker_threads';
-
 import { RequestCommand } from '../types/ocpp/Requests';
 import {
   StartTransactionRequest,
@@ -13,14 +11,15 @@ import {
   BroadcastChannelRequest,
 } from '../types/WorkerBroadcastChannel';
 import ChargingStation from './ChargingStation';
+import WorkerBroadcastChannel from './WorkerBroadcastChannel';
 
 type MessageEvent = { data: unknown };
 
-export default class ChargingStationWorkerBroadcastChannel extends BroadcastChannel {
+export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChannel {
   private readonly chargingStation: ChargingStation;
 
   constructor(chargingStation: ChargingStation) {
-    super('worker');
+    super();
     this.chargingStation = chargingStation;
     this.onmessage = this.handleRequest.bind(this) as (message: MessageEvent) => void;
   }