February 2018
Intermediate to advanced
298 pages
8h 22m
English
The ES6 Proxy API provides the proxy constructor to create proxies. The proxy constructor takes two arguments, which are:
A trap can be defined for every possible operation on the target object. If a trap is not defined, then the default action takes place on the target. Here is a code example that shows how to create a proxy, and does various operations on the target object. In this example, we have not defined any traps:
const target = { age: 12 }; const handler = {}; const proxy = new Proxy(target, handler); proxy.name = "Eden"; console.log(target.name); console.log(proxy.name); ...Read now
Unlock full access