createIpcSlice

A function that creates a slice of IPCs to be used by combineIpcs function.

Example

shared/ipcs/main/index.ts


import { createIpcSlice } from 'interprocess'

export const getPingIpcSlice = createIpcSlice({
  main: {
    async getPing(_, data: 'ping') {
      return `from renderer: ${data} on main process`
    },
  },
})

shared/ipcs/renderer/index.ts


import { createIpcSlice } from 'interprocess'

export const getPongIpcSlice = createIpcSlice({
  renderer: {
    async getPong(_, data: 'pong') {
      return `from main: ${data} on renderer process`
    },
  },
})