Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

ipc-promise

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipc-promise

ipc use as Promises

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

ipc-promise

Build Status Dependency Status NPM version

ipc use as Promises

Installation

npm

$ npm install ipc-promise

Usage

main process

var ipcPromise = require('ipc-promise');

ipcPromise.on('twice', function(params) {
  return Promise.resolve(params.value * 2);
});

var electron = require('electron'),
    app = electron.app,
    BrowserWindow = electron.BrowserWindow,
    mainWindow;

app.on('ready', function() {
  mainWindow = new BrowserWindow({});
  mainWindow.loadURL('file://' + __dirname + '/index.html');
});

renderer process

<!DOCTYPE html>
<script src="ipc-promise.min.js"></script>
<script>
  ipcPromise
    .send('twice', {
      value: 1
    })
    .then(function(result) {
      console.log(result);  // => "2"
    });
</script>

Functions

on(event, listener)

  • event
    • String - event name
  • listener
    • Function(*): Promise - listener function

listen event.

send(event, data)

  • event
    • String - event name
  • data
    • * - data for send
  • return
    • Promise - Promises

trigger event.

Test

$ npm install
$ npm test

License

The MIT license. Please see LICENSE file.

FAQs

Package last updated on 16 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts