1.1.1 • Published 8 years ago

tiny-proxy v1.1.1

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
8 years ago

tiny-proxy

Tiny Object proxy for Client or Server

build status

API

proxy(obj, readOnly = false, changeHandler)

Returns a proxy for obj with getters & setters, or only getters if readOnly is true.

Example

const proxy = require('tiny-proxy');
let original = {a: true};
let facade = proxy(original, false, function (key, oldValue, newValue) {
	console.log(key + ' was ' + oldValue + ', and is now ' + newValue);
});

facade.a = false; // a was true, and is now false

Handling changes

Writable proxies will fire the onchange function after applying a change with the key, oldValue & newValue as arguments.

License

Copyright (c) 2014 Jason Mulligan Licensed under the BSD-3 license

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago