You don't need to distinguish main process & renderer process any more.
After regist event in main process, you can call registed event in render process.
npm i electron-tunnel
regist event in main process
const app BrowserWindow =const path =const registNativeEvent =app
- call event in renderer process
const callNativeEvent =var $print = document
registNativeEvent(eventName: string, fn: (params: any) => Promise<any>)
fn: native event
paramspassed by callNativeEvent
callNativeEvent(eventName: String, params: any)
params: will be passed to event function