diff --git a/package-lock.json b/package-lock.json index 8ca0fc9..6ca0617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16432,7 +16432,7 @@ "node_modules/trackaudio-afv": { "version": "1.0.0", "resolved": "file:backend/trackaudio-afv-1.0.0.tgz", - "integrity": "sha512-yUly26TGg2RHCRAYiMTV31T/DtrMeB5SDgP2oVUiw09xRgLBqB4vK/U6t10jHOSGM+OV30qGfqyNpwS8wMCgNQ==", + "integrity": "sha512-kut9G4k+t07OGODbHB/oLL/rY9u+XlrWKMmTRS8MNcp3Cdb0Lmmal5nct7fL9CNUpCy2MRL8VMVDGK8DTfnOjA==", "dependencies": { "bindings": "^1.5.0", "node-addon-api": "^1.1.0" diff --git a/src/app/components/bootstrap.tsx b/src/app/components/bootstrap.tsx index 09453ab..8808d43 100644 --- a/src/app/components/bootstrap.tsx +++ b/src/app/components/bootstrap.tsx @@ -144,6 +144,22 @@ const Bootsrap: React.FC = () => { .catch((err: unknown) => { console.error(err); }); + + return () => { + window.api.removeAllListeners("VuMeter"); + window.api.removeAllListeners("station-transceivers-updated"); + window.api.removeAllListeners("station-data-received"); + window.api.removeAllListeners("FrequencyRxBegin"); + window.api.removeAllListeners("StationRxBegin"); + window.api.removeAllListeners("FrequencyRxEnd"); + window.api.removeAllListeners("PttState"); + window.api.removeAllListeners("error"); + window.api.removeAllListeners("VoiceConnected"); + window.api.removeAllListeners("VoiceDisconnected"); + window.api.removeAllListeners("network-connected"); + window.api.removeAllListeners("network-disconnected"); + window.api.removeAllListeners("ptt-key-set"); + } }, []); return null; diff --git a/src/preload.ts b/src/preload.ts index 428f581..d9a9ff3 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -9,6 +9,9 @@ const IElectronAPI = { listener(...args); }); }, + removeAllListeners: (channel: string) => { + ipcRenderer.removeAllListeners(channel); + }, setAlwaysOnTop: (state: boolean) => { ipcRenderer.send("set-always-on-top", state);