Tutorial by Examples

This proxy simply appends the string " went through proxy" to every string property set on the target object. let object = {}; let handler = { set(target, prop, value){ // Note that ES6 object syntax is used if('string' === typeof value){ target[prop] = valu...
To influence property lookup, the get handler must be used. In this example, we modify property lookup so that not only the value, but also the type of that value is returned. We use Reflect to ease this. let handler = { get(target, property) { if (!Reflect.has(target, property)) { ...

Page 1 of 1