poor-mans-proxy
ES6 Proxy pollyfill, with many limitations
This is a best effort polyfill, as most of Proxy's functionality can not be implemented in userland.
Install
npm install poor-mans-proxy --save
Usage
; var obj = name: 'Obj'; var proxy = obj { console; return targetprop; }; console; // : name accessed // : Obj
API
new Proxy(target [, handler])
Creates a Proxy of the target object, with handlers defined by the handler object.
target Object|Function
Object or Function to proxy.
handler Object
Handler definitions.
.get = function(target, property, receiver) The handler.get() method is a trap for getting a property value. See Get
.set = function(target, property, value, receiver) The handler.set() method is a trap for setting a property value. See Set
.apply = function(target, thisArg, argumentsList) The handler.apply() method is a trap for a function call (if
target
is a function). See Apply
The target
object's properties must be defined before calling new Proxy()
. Dynamic properties are not supported.
Test
npm installnpm test