# rxdb-plugin-proxy

> proxy data plugin for rxdb

Latest version **0.0.3** (published 2019-07-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install rxdb-plugin-proxy
pnpm add rxdb-plugin-proxy
yarn add rxdb-plugin-proxy
bun add rxdb-plugin-proxy
```

## 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 | 2019-07-01 |
| First published | 2019-07-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | leozale |

## Links

- npm: https://www.npmjs.com/package/rxdb-plugin-proxy
- Repository: https://github.com/leozale/rxdb-plugin-proxy
- Homepage: https://github.com/leozale/rxdb-plugin-proxy#readme
- Issues: https://github.com/leozale/rxdb-plugin-proxy/issues
- npm.io page: https://npm.io/package/rxdb-plugin-proxy

## Recent versions

- 0.0.3 (latest) — 2019-07-01
- 0.0.2 — 2019-07-01
- 0.0.1 — 2019-07-01

## README

# rxdb-plugin-proxy
proxy data plugin for rxdb

# way
see https://github.com/pubkey/rxdb/issues/1269

# example
```js
const RxDB = require("rxdb");
RxDB.plugin(require("pouchdb-adapter-memory"));
RxDB.plugin(require("rxdb-plugin-proxy"));


(async () => {
  const db = await RxDB.create({
    name: "db1",
    adapter: "memory"
  });

  const docSchema = {
    version: 0,
    type: "object",
    properties: {
      name: {
        type: "string"
      }
    }
  };

  const Doc = await db.collection({
    name: "doc",
    schema: docSchema,
    methods: {
      // add proxy's methods.
      change(name) {
        this.name = name; // RXDocument can't call
      }        
    }

  });

  const doc = await Doc.insert({
    name: "first"
  });

  console.log(doc.name);

  const pdoc = doc.proxy();
  pdoc.change("leo");
  console.log(pdoc.name, doc.name); // real-time out: "leo first"
  pdoc.change("leo2");
  console.log(pdoc.name, doc.name); // real-time out: "leo2 first"
  pdoc.change("leo3");
  console.log(pdoc.name, doc.name); // real-time out: "leo3 first"

  await pdoc.store(); // save doc
  console.log(pdoc.name, doc.name); // out: "leo3 leo3"
})();

```

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