1.0.2 • Published 7 years ago
electron-simple-ipc v1.0.2
electron-simple-ipc
This standardises IPC in electron so it works the same in all threads. It will also JSON stringify/parse any objects send over IPC. This makes IPC much much faster.
Install
npm install electron-simple-ipc
Usage
Usage is the same in both the renderer/electron threads.
For example:
In electron:
const { ipcSend, ipcReceive } = require('electron-simple-ipc');
ipcSend('EVENT_FROM_ELECTRON', {
data1: 'some data in the event payload'
})
ipcReceive('EVENT_FROM_RENDERER', (payload) => {
console.log('We process the payload here', payload);
})
In Renderer:
const { ipcSend, ipcReceive } = require('electron-simple-ipc');
ipcSend('EVENT_FROM_RENDERER', {
data1: 'some data in the event payload'
})
ipcReceive('EVENT_FROM_ELECTRON', (payload) => {
console.log('We process the payload here', payload);
})