# @tkfnetwork/rx-storage

> RxJS wrapper for listening and subscribing to Storage based events

Latest version **0.0.6** (published 2023-05-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @tkfnetwork/rx-storage
pnpm add @tkfnetwork/rx-storage
yarn add @tkfnetwork/rx-storage
bun add @tkfnetwork/rx-storage
```

## 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.0.6 |
| Published | 2023-05-13 |
| First published | 2023-05-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 17.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kris Pomphrey |
| Maintainers | tkfnetwork |
| Keywords | rxjs, storage, localstorage |

## Links

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

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^7.8.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2023-05-13
- 0.0.5 — 2023-05-08
- 0.0.4 — 2023-05-08
- 0.0.3 — 2023-05-08
- 0.0.2 — 2023-05-08

## README

# RxStorage
RxStorage is a simple wrapper class for anything that extends the [`Storage` interface](https://developer.mozilla.org/en-US/docs/Web/API/Storage) so that they can be subscribed to in the RxJS world.

## Installation

**NPM**

```
$ npm i @tkfnetwork/rx-storage
```

**yarn**

```
$ yarn add @tkfnetwork/rx-storage
```

**PNPM**

```
$ pnpm add @tkfnetwork/rx-storage
```

## Usage

Using this helper class is fairly simple...

### Creation

Create your wrapped storage class

```ts
const localStore = new RxStorage(localStorage);
const sessionStore = new RxStorage(sessionStorage);
```
### Observing

You can now observe storage keys by doing the following

```ts
const someValue$ = localStore.getItem$(key);
  
someValue$.subscribe(value => {
    console.log(value) // Will emit the value when it changes
});

// Setting a value into the storage as normal
// will emit the value to any subscribers (if the
// key already existed inside the storage instance)
localStore.setItem(key, value);
```

You can still get the storage as normal

```ts
const someValue = localStore.getItem(key);
```

### Other tabs/windows/frames
RxStorage class automatically listens for storage changes in
other tabs and windows and will automatically sync changes
into your active instance

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