# rx-ipc

> RxJS utility for Electron JS IPC

Latest version **1.2.0** (published 2020-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install rx-ipc
pnpm add rx-ipc
yarn add rx-ipc
bun add rx-ipc
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2020-07-07 |
| First published | 2020-06-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Brandon Keiji |
| Maintainers | keijibranshi |
| Keywords | rxjs, electron, ipc, observable |

## Links

- npm: https://www.npmjs.com/package/rx-ipc
- Repository: https://github.com/KeijiBranshi/rx-ipc
- Homepage: https://github.com/KeijiBranshi/rx-ipc#readme
- Issues: https://github.com/KeijiBranshi/rx-ipc/issues
- npm.io page: https://npm.io/package/rx-ipc

## Dependencies (2)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.12
- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.7

## Recent versions

- 1.2.0 (latest) — 2020-07-07
- 1.0.1 — 2020-06-30
- 1.0.0-beta.1 — 2020-06-30
- 1.0.0-beta.0 — 2020-06-30

## README

# RxJS Utility for Electron IPC

## Modules

### Proxy Observables

Create an `Observable` in one process, and remotely observe it from another.

#### In Renderer Process
```javascript
import "rx-ipc/add/operator/proxify";
import { of } from "rxjs/observable/of";
import { v4 as uuid } from "node-uuid";
import { ipcRenderer as ipc } from "electron";

const channel = "some-identifier";
const proxiedEvents = of("foo").proxify({ ipc, channel, uuid });

proxiedEvents.subscribe(({ observer, payload }) => {
  // maps to a "proxy report"
  // `observer` = "next"; `payload` = "foo"
  console.log(`Routed { ${payload} } to { ${observer} } callback in main`);
});
```

#### In Main Process
```javascript
/** In Main Process */
import { createProxy } from "rx-ipc";
import { ipcMain as ipc } from "electron";

const channel = "some-identifier"; // must match the channel of renderer
createProxy({ channel, ipc, uuid }).subscribe((payload) => {
  // Will receive "payload" (from the report above)
  // `payload` = "foo"
  console.log(`Message From Renderer: ${message}`);
});
```

> Note: You could swap the MainProcess and RendererProcess code snippets above, and it would still work

## TODO

1. Upgrade to RxJS v6. At the moment, I'm consuming this in an app that requires RxJS v5.

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