Electron IPC promise
It's a handy tool for electron ipc communication between ipcMain, ipcRender and webview.
Install
npm install electron-ipc-promise --save
Usage
ipc between ipcMain and ipcRenderer
/** -- in main.js*/var ipcMain = ipcMain;var ipcPromise = ;// create your new BrowserWindow before initializing ipcMainvar ipc = ipcPromise;ipc;ipc;/** -- in renderer.js*/var ipcRenderer = ipcRenderer;var ipcPromise = ;var ipc = ipcPromise;ipc;ipc;
ipc between ipcRenderer and Webview
/** -- in renderer.js*/var ipcPromise = ;// get the webview reference before initializing ipcHostvar ipc = ipcPromise;ipc;ipc;/** -- in webview.js*/var ipcRenderer = ipcRenderer;var ipcPromise = ;var ipc = ipcPromise;ipc;ipc;
multiple channels
// pass a uid to initialize functionvar ipcGH = ;var ipcMH = ;
TODO
- ipc pipe
- one renderer directly with another renderer)
- main directly with webview