# electron-ipc-promises

> Electron IPC with Promises.

Latest version **0.0.3** (published 2020-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-ipc-promises
pnpm add electron-ipc-promises
yarn add electron-ipc-promises
bun add electron-ipc-promises
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-04-23 |
| First published | 2020-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Agnoli Engineering |
| Maintainers | dthreel |

## Links

- npm: https://www.npmjs.com/package/electron-ipc-promises
- Repository: https://github.com/Agnoli-Engineering/electron-ipc-promises
- Homepage: https://github.com/Agnoli-Engineering/electron-ipc-promises#readme
- Issues: https://github.com/Agnoli-Engineering/electron-ipc-promises/issues
- npm.io page: https://npm.io/package/electron-ipc-promises

## Dependencies (1)

- [is-electron-renderer](https://npm.io/package/is-electron-renderer.md) ^2.0.1

## Recent versions

- 0.0.3 (latest) — 2020-04-23
- 0.0.2 — 2020-04-22
- 0.0.1 — 2020-04-22

## README

# electron-ipc-promises (0.0.3)

Electron's IPC with Promises:

### Main Process:

```javascript
import ipc from "electron-ipc-promises"

ipc.main.on("add-sync", num => {
	return num + 1
})

ipc.main.on("add-async", num => {
	return new Promise(resolve => {
		setTimeout(() => {
			resolve(num + 1)
		}, 2000)
	})
})
```

### Renderer Process:
```javascript
import ipc from "electron-ipc-promises"

ipc.renderer.send("add-sync", 3)
.then(result => {
	console.log(result) // 4
})

ipc.renderer.send("add-async", 3)
.then(result => {
	console.log(result) // 4 after 2 seconds
})
```

Same thing goes the other way around too (from main to renderer).


### Installation

`$ npm install --save electron-ipc-promises`

or ...

`$ yarn add electron-ipc-promises`


### Testing

Run `$ npm run test`.

---
_Source: https://npm.io/package/electron-ipc-promises · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
