dp

delegable-proxy

Multi-level deepened proxy.

Showing:

Popularity

Downloads/wk

1

GitHub Stars

1

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

delegable-proxy

Multi-level deepened proxy, works sync.

Build Status npm version Maintainability Test Coverage

Main purpose

For convenience sake we want to work with common lists and objects but keep track of every change to commit them to the underlying storage. Object.observe() and Array.observe() are pretty much the exact thing we want, but both work async via polling.

The proxy returns the type of mutation (add, del, mod) and which position (in root object) is affected.

Example

import DelegableProxy from 'delegable-proxy'

const example = [{'message': 'hello world'}]
const data = DelegableProxy.wire(example, (action, pos) => {
  console.log(action, pos)
})
data.push({'message': 'hi there!'})
data.push({'message': 'knock knock!'})

RunKit

https://runkit.com/586ca4b68acd620014d54362/586ca4b68acd620014d54363

Known issues

  • The way Array.splice works, leads to a lot of mutations on inner arrays. Better use the slow delete foo[42].bar.stuff[0].
  • We do not recommend to use this library in a production environment. This was just a fun project, some kind of PoC for us. We still use it in a dev environment which is only used internally.

Usage

# add the library
yarn add delegable-proxy

# build the library
yarn build

# run the tests
yarn test

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial