JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q31357F
  • License MIT

Deep replace data with a new Proxy listeners

Package Exports

  • @clubajax/proxify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@clubajax/proxify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

proxify

Deep replace data with a new Proxy listeners

proxify uses UMD, so it will work with globals, AMD, or Node-style module exports.

Installation

To install using npm:

npm install @clubajax/proxify --save

You can clone the repository with your generic clone commands as a standalone repository or submodule.

git clone git://github.com/clubajax/proxify.git

proxify has no dependencies.

Description

The primary function is to make it to set change an object and all of its child objects to Proxies, so all changes will emit change-callbacks.

Support

proxify supports modern browsers. IE11 is not tested but should work with a proxy shim.

This library uses UMD, meaning it can be consumed with RequireJS, Browserify (CommonJS), or a standard browser global.

Usage

Signature:

proxifiedData = proxify(dataToBeProxified, options)

options:

  • onChange: called back when a property is set
  • onSet: same as onChange
  • onGet: called back when a property is accessed
const data = {
    x: 1,
    deep: {
        y: 2
    }
};

const proxifiedData = proxify(data, {
    onChange: function (value, key, target) {
        console.log('changed', key, value);
    }
});

License

This uses the MIT license. Feel free to use, and redistribute at will.