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 think it's more easy to use since it uses module augmentation.
For instance, we could rewrite your example in this way:
// ipc schemadeclare module "typed-ipc"{interfaceIpcMainEvents{'no-payload': void;'simple-payload': string;'complex-payload': {foo: string;bar: {baz: number;}};}}// there is no need to export functions
And use it somewhere in main/renderer process:
// everything is type safe and matches the schema, that we declared above// mainimport{typedIpcMain}from"typed-ipc";typedIpcMain.addEventListener("complex-payload",async(_event,{ foo, bar })=>{// ...});// rendererimport{typedIpcRenderer}from"typed-ipc";typedIpcRenderer.send("complex-payload",{foo: "str",bar: {baz: 5}});
The text was updated successfully, but these errors were encountered:
@orourkek Please have a look at this lib: https://github.com/zardoy/typed-ipc.
I think it's more easy to use since it uses module augmentation.
For instance, we could rewrite your example in this way:
And use it somewhere in main/renderer process:
The text was updated successfully, but these errors were encountered: