diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2022-08-05 11:06:54 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-08-22 08:34:37 +0200 |
| commit | 5890d65e59919356fd257e2a8d21630ec5cc7260 (patch) | |
| tree | 891be8fc28c3456c515e4d69894d930559117ea7 /gui/src/shared | |
| parent | b9100181bee6e6cd02e5f41d0ff06aad20c3e083 (diff) | |
| download | mullvadvpn-5890d65e59919356fd257e2a8d21630ec5cc7260.tar.xz mullvadvpn-5890d65e59919356fd257e2a8d21630ec5cc7260.zip | |
Curry IpcMainEventChannel functions with WebContents where applicable
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/ipc-helpers.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gui/src/shared/ipc-helpers.ts b/gui/src/shared/ipc-helpers.ts index cde27bb32b..1680b45d11 100644 --- a/gui/src/shared/ipc-helpers.ts +++ b/gui/src/shared/ipc-helpers.ts @@ -23,7 +23,7 @@ interface RendererToMain<T, R> { // eslint-disable-next-line @typescript-eslint/no-explicit-any type AnyIpcCall = MainToRenderer<any> | RendererToMain<any, any>; -type Schema = Record<string, Record<string, AnyIpcCall>>; +export type Schema = Record<string, Record<string, AnyIpcCall>>; // Renames all IPC calls, e.g. `callName` to either `notifyCallName` or `handleCallName` depending // on direction. @@ -48,14 +48,14 @@ type IpcRendererFn<I extends AnyIpcCall> = I['direction'] extends 'main-to-rende : ReturnType<I['send']>; // Transforms the provided schema to the correct type for the main event channel. -type IpcMain<S extends Schema> = { +export type IpcMain<S extends Schema> = { [G in keyof S]: { [K in keyof S[G] as IpcMainKey<string & K, S[G][K]>]: IpcMainFn<S[G][K]>; }; }; // Transforms the provided schema to the correct type for the renderer event channel. -type IpcRenderer<S extends Schema> = { +export type IpcRenderer<S extends Schema> = { [G in keyof S]: { [K in keyof S[G] as IpcRendererKey<string & K, S[G][K]>]: IpcRendererFn<S[G][K]>; }; |
