feat(electronSecurity): make on method more secure

This commit is contained in:
Johannes Millan 2023-12-17 14:05:48 +01:00
parent a32281e07f
commit c3cba4d9b3

View file

@ -12,9 +12,10 @@ const _invoke: (channel: IPCEventValue, ...args: any[]) => Promise<unknown> = (
) => ipcRenderer.invoke(channel, ...args);
const ea: ElectronAPI = {
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) =>
ipcRenderer.on(channel, listener),
on: (channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) => {
// NOTE: there is no proper way to unsubscribe apart from unsusbscribing all
ipcRenderer.on(channel, listener);
},
// INVOKE
// ------
getUserDataPath: () => _invoke('GET_PATH', 'userData') as Promise<string>,