es2015-proxy-shim
v1.2.0
Published
A limited ES2015 Proxy shim.
Downloads
19
Readme
es2015-proxy-shim
An ES2015 Proxy shim that relies on a non-extensible fixed set of properties at the time of proxying a target object or function.
This shim is limited to a few supported traps:
construct
,apply
(on functions)get
,set
This shim relies on a decent ES2015 support, e.g.
- for-of loops
- symbols
WeakMap
Reflect
Use shims like core-js, if needed.
This shim patches Reflect.set
which needs to walk in sync w.r.t. proxy objects.
Install
$ npm install es2015-proxy-shim --save
Usage
require("core-js/shim");
require("es2015-proxy-shim");
var p = new Proxy({ foo: 5 }, {
get: function(t, k, r) {
console.log("#get", t, k);
return Reflect.get(t, k, r);
}
});
p.foo = 8;
console.log("is", p.foo);
License
MIT © Daniel Bölzle