When Should You Use a Proxy?
Problem
What is a proxy and when should you use one?
Solution
A proxy object allows you to customize the behavior of an object. Some of the ways you can use a proxy is for interception of an object, object virtualization, profiling, and contracts for object use.
The Code
Listing 16-1. Creating and Using a Proxy
var handler = {
set (target, key, value){
console.info(`property "${key} set on object "${target}" with a value of "${value}"`);
}
}
var target = {};
var proxy = new Proxy(target, ...