JS โฉ object โฉ built-in โฉ Proxy
A Proxy wraps another object/function and intercepts
object creation
property creation/access/enumeration/testing
method invocation
// โญ๏ธ proxy should shadow the original (target) object/function. obj = new Proxy(obj, { // handler methods __proto__: null, // prevent from inheriting unnecessary methods. });
a Proxy object doesn't have own properties.
JavaScript enforces some invariants โ conditions that must be fulfilled by internal methods and traps. ๐ javascript.info
handler method
Reflect API
Proxy examples
Proxy intercepts property creation/access/enumeration/testing.
JS.info โฉ Proxy and Reflect
JavaScript: The Definitive Guide โฉ 14.7 Proxy Objects
Proxy
Last updated 2 years ago
Was this helpful?