electron-tiny-rpc
v1.0.0
Published
> Simple, light-weight RPC over Electron's IPC.
Downloads
1
Readme
electron-tiny-rpc
Simple, light-weight RPC over Electron's IPC.
Example
In your main process, do something like:
const { Server } = require('electron-tiny-rpc')
const server = new Server({
add ({ a, b }) {
return Promise.resolve(a + b)
},
boom () {
return Promise.reject(new Error('💥'))
}
})
And in your renderer, do:
const { Client } = require('electron-tiny-rpc')
const client = new Client()
const result = await client.call('add', { a: 12, b: 12 })
try {
await client.call('boom')
} catch (err) {
console.error(err)
}
License
MIT