cjs-property-watcher

1.1.1 • Public • Published

Watches for a property modifications

build status npm version dependencies status devDependencies status Gitter RunKit

Installation

npm install cjs-property-watcher

Usage

Add to the scope:

var watch = require('cjs-property-watcher');

Add hook for an object property:

var obj = {
    fld: 123
};
 
watch(obj, 'fld', function ( name, oldValue, newValue ) {
    console.log('obj.' + name + ' changed from ' + oldValue + ' to ' + newValue);
});

Trigger the hook with property modification:

obj.fld = 256;

Contribution

If you have any problems or suggestions please open an issue according to the contribution rules.

License

cjs-property-watcher is released under the MIT License.

Package Sidebar

Install

npm i cjs-property-watcher

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

4.28 kB

Total Files

4

Last publish

Collaborators

  • cjssdk