add rpc system to improve ipc

This commit is contained in:
Thomas Nordquist
2022-02-27 18:44:17 +01:00
parent 205ea00c41
commit e1493db7c8
27 changed files with 252 additions and 303 deletions

View File

@@ -0,0 +1,12 @@
import { ipcMain, ipcRenderer } from 'electron'
import { IpcMainEventBus } from './IpcMainEventBus'
import { IpcRendererEventBus } from './IpcRendererEventBus'
import { Rpc } from './Rpc'
export const rendererEvents = new IpcRendererEventBus(ipcRenderer)
export const backendEvents = new IpcMainEventBus(ipcMain)
// Preferred way to communicate typesafe
export const rendererRpc = new Rpc(rendererEvents)
export const backendRpc = new Rpc(backendEvents)