You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wondering how to use it in a project that follows the Inversion of Control principle (through dependency injection).
Instead of this structure :
exportconstgetPingIpcSlice=createIpcSlice({main: {asyncgetPing(_,data: 'ping'){return`from renderer: ${data} on main process`},},})
I have something like :
exportclassMyController{constructor(privatemyService: MyService){}asyncgetPing(_,data: 'ping'){constres=awaitthis.myService.doSomething(data)return`from renderer: ${res} on main process`}}
But with this I don't see how I can import these methods into a shared file that uses combineIpcs.
What do you think ?
If I understand correctly, handlers in the shared folder can be "dummy" handlers, to ensure typings are correct on both end, and I can then implement real logic using ipcMain.handle.
If I'm correct, what would you recommend for handlers that return complex data ? returning a dummy object like so ?
import{createInterprocess}from'interprocess'exportconst{ ipcMain, ipcRenderer, exposeApiToGlobalWindow }=createInterprocess({main: {// method will be really handled by mainasyncsetMaximize(_,data: {maximize: boolean}){return{isMaximized: true}}},renderer: {}})
Repository owner locked and limited conversation to collaborators on Nov 29, 2022
Activity
michael-dm commentedon Nov 29, 2022
If I understand correctly, handlers in the
sharedfolder can be "dummy" handlers, to ensure typings are correct on both end, and I can then implement real logic usingipcMain.handle.If I'm correct, what would you recommend for handlers that return complex data ? returning a dummy object like so ?