Proxy
suggest changeVersions
Proxies have been in the language since ES6.
Introduction
A Proxy in JavaScript can be used to modify fundamental operations on objects. Proxies were introduced in ES6. A Proxy on an object is itself an object, that has traps. Traps may be triggered when operations are performed on the Proxy. This includes property lookup, function calling, modifying properties, adding properties, et cetera. When no applicable trap is defined, the operation is performed on the proxied object as if there was no Proxy.
Syntax
let proxied = new Proxy(target, handler);
Parameters
| Parameter | Details |
|---|---|
| target | The object whose operations (getting, setting, and so on) are intercepted. |
| handler | An object that can define traps for those operations. |
Remarks
A full list of traps is in the MDN Proxy reference.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents