0.1.5 • Published 3 years ago

recursion-proxy v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Recursion Proxy Implementation (ES6+)

Example

import RecursionProxy from 'recursion-proxy';

const source = {a: { b: { c: { d: 5 } } } };

const proxy = new RecursionProxy(source, {
  get(target, prop, receiver, propPath) {
    console.log("get prop:", propPath);
    return Reflect.get(target, prop, receiver);
  },
  set(target, p, value, r, propPath, reactiveWrapper) {
    console.log("set prop:", propPath);
    return Reflect.set(
      target, 
      p, 
      reactiveWrapper(value),  // Wrap to Recursion Proxy Object
      r
    );
  }
});

let a = proxy.a.b.c.d;
// Console Output: get prop: ["a", "b", "c", "d"]

proxy.b = {};
// Console Output: set prop: ["b"]

console.log(proxy.b) // Proxy {}

proxy.b.b
// Console Output: get prop: ["b", "b"]
0.1.5

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago