# ipc-shell

> Vea la [página](https://gbenm.github.io/ipc-shell/) para más información.

Latest version **0.2.2** (published 2022-02-06) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2022-02-06 |
| First published | 2022-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Josué Galeano |
| Maintainers | bengm |
| Keywords | ipc, electron |

## Links

- npm: https://www.npmjs.com/package/ipc-shell
- Repository: https://github.com/gbenm/ipc-shell
- Issues: https://github.com/gbenm/ipc-shell/issues
- npm.io page: https://npm.io/package/ipc-shell

## Recent versions

- 0.2.2 (latest) — 2022-02-06
- 0.2.1 — 2022-02-05
- 0.2.0 — 2022-02-05
- 0.1.1 — 2022-02-04
- 0.0.1 — 2022-02-04

## README

# IPC Shell

Vea la [página](https://gbenm.github.io/ipc-shell/) para más información.

Es una envoltura para objetos que realizan la comunicación
entre procesos, en el estado inicial, está configurado para
funcionar con los IPC de [electron](https://www.electronjs.org/),
este comportamiento puede cambiar sobreescribiendo las funciones
`_getArgsFromOn` e `_ipcNodeSend`.

## Como usar
Importe `IPCNodeRegister` y registre el IPC:

```typescript
import { ipcMain } from "electron";
import { IPCNodeRegister } from "ipc-shell"

const ipc = IPCNodeRegister.register("main", ipcMain)
```

**Nota: se usará `IpcMain` como el tipo de IPC, si
fuera para el `ipcRenderer` debería usar `IpcRenderer`,
para el ipc de `win.webContents` debería usar `WebContents`,
hablando en términos de electronjs, en general usar
la clase del IPC que registra.**

Note que ahora `ipc` fue extendido. Colocando el tipo sería
de la siguiente forma (por la inferencia de tipos lo de arriba
está bien):

```typescript
import { IpcMain, ipcMain } from "electron";
import { IPCNode, IPCNodeRegister } from "ipc-shell"

const ipc: IPCNode<IpcMain> = IPCNodeRegister.register("main", ipcMain)
```

A partir de ahora puede acceder en el mismo proceso a este
IPC mediante su nombre:

```typescript
// somewhere else

import { IpcMain } from "electron";
import { IPCNodeRegister } from "ipc-shell"

// using generic type (recommended)
const ipc = IPCNodeRegister.get<IpcMain>("main");

// using IPCNode type (import from ipc-shell)
const ipc: IPCNode<IpcMain> = IPCNodeRegister.get("main");
```

El hecho de que se agregue `IpcMain` es para que pueda
seguir utilizando todos lo métodos y variables que este
contenga más los extras, si no agrega el tipo únicamente
podrá usar los de `IPCNode`.

## Disclaimer
- This package use `Object.assign()`.
- All in the `IPCBaseNode` interface is overwritten when it extends.

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