# @wranggle/storage-remote

> Relay storage methods to a different window/process using @wranggle/rpc

Latest version **0.2.4** (published 2019-03-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @wranggle/storage-remote
pnpm add @wranggle/storage-remote
yarn add @wranggle/storage-remote
bun add @wranggle/storage-remote
```

## Health

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

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

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2019-03-22 |
| First published | 2019-03-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 32.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeff Ferber |
| Maintainers | wranggle.ferbs |
| Keywords | wranggle-storage, storage, persistence, middleware, wranggle-rpc |

## Links

- npm: https://www.npmjs.com/package/@wranggle/storage-remote
- Repository: https://github.com/wranggle/storage
- Issues: https://github.com/wranggle/storage/issues
- npm.io page: https://npm.io/package/@wranggle/storage-remote

## Dependencies (2)

- [@wranggle/rpc-core](https://npm.io/package/@wranggle/rpc-core.md) >=0.3.0
- [@wranggle/storage-core](https://npm.io/package/@wranggle/storage-core.md) ^0.2.4

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2019-03-22
- 0.2.3 — 2019-03-21
- 0.2.2 — 2019-03-19
- 0.2.1 — 2019-03-19

## README

# Remote Store

This package contains two classes:

* *RemoteRelayAdapter* is a persistence adapter, letting you use WranggleStorage in a window/process different from the one actually storing your data. It behaves like normal, transparently sending data requests over [@wranggle/rpc](https://github.com/wranggle/rpc) to a different window/process, the one that has the actual store.

* *RpcStorageListener* listens for and serves requests sent by another window/process.


## RemoteRelayAdapter
RemoteRelayAdapter is a [WranggleStorage](https://github.com/wranggle/storage) persistence adapter. It is not bundled in the `@wranggle/storage-node` or `@wranggle/storage-web` packages, but otherwise behaves like any other store.

You can create it using the `remote` shortcut:

```javascript
import { RemoteRelayAdapter } from '@wranggle/storage-remote';
const rpcOpts = {
  channel: 'main-data',
  transport: 'chrome'
}
const store = new WranggleStorage({ remote:  rpcOpts });    
```

The other window/process must set its corresponding rpcOpts (eg, channel and transport) such that they can communicate over [@wranggle/rpc](https://github.com/wranggle/rpc). 


## RpcStorageListener
RpcStorageListener sets up a [@wranggle/rpc](https://github.com/wranggle/rpc) request handler to respond to data method requests sent by a RemoteRelayAdapter in a different window/process. 

You create it with an existing WranggleStorage instance, plus rpcOpts that can communicate with the other window/process. Eg: 

```javascript
import { RpcStorageListener } from '@wranggle/storage-remote';
const listener = new RpcStorageListener(someExistingStore, {
  channel: 'main-data',
  transport: 'chrome'            
});
```

#### Methods

* **stopTransport**

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