1.0.1 • Published 7 years ago

ipc-promises v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Promise interface for the ipc commands in electron.

Example

// renderer.js
import { ipcRenderer } from 'electron';
import ipc from 'ipc-promises';

const tunnel = new ipc(ipcRenderer);

tunnel.send('getsomedata').then((resp) => {
  // resp contains the data
});

// main.js
import { ipcMain } from 'electron';
import ipc from 'ipc-promises';

const tunnel = new ipc(ipcMain);

tunnel.on('getsomedata').then((id) => {
  mainTunnel.respond(id, 'data not accessible by the renderer');
});