1.3.0 • Published 4 years ago

promisify-electron-ipc v1.3.0

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

promisify-electron-ipc

Build Status Coveralls github devDependency Status npm

Library to easily use promises for inter-process communication in electron.

Installation

npm install promisify-electron-ipc

or

yarn add promisify-electron-ipc

Documentation

You can find the documentation here.

Usage

Sending messages from the renderer to the main process:

// In the main process
import { promiseIpcMain } from "promisify-electron-ipc";

promiseIpcMain.on("greet-channel", name => {
    return Promise.resolve("Hello " + name);
});
// In the renderer
import { promiseIpcRenderer } from "promisify-electron-ipc";

promiseIpcRenderer
    .send("greet-channel", "Bob")
    .then(answer => console.log(answer)); // prints "Hello Bob"

Sending messages from the main process to the renderer:

// In the main process
import { promiseIpcMain } from "promisify-electron-ipc";

promiseIpcMain
    .send("greet-channel", win.webContents, "Bob")
    .then(answer => console.log(answer));
// In the renderer
import { promiseIpcRenderer } from "promisify-electron-ipc";

promiseIpcRenderer.on("greet-channel", name => {
    return Promise.resolve("Hello " + name);
});

Credits

This library was inspired by sibnerian

1.3.0

4 years ago

1.2.0

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago