
Modern JS Discussion Proxy
This article was originally published on bmf-tech.com . ※This article is a reprint from the Innovator Japan Engineers’ Blog . What is Proxy Proxy is an object added in ECMAScript 2015 that allows you to customize the functionality of an object by wrapping its features. Related Terms for Proxy These are the terms necessary to understand Proxy. handler ・・・An object for inserting traps, treated as a placeholder. trap ・・・A method for Proxy to implement access to properties. target ・・・The object being proxied. invariant ・・・An unchanging condition when customizing the functionality of an object. How to Use Proxy The basic syntax is as follows: let proxy = new Proxy ( target , handler ); Define the object or function you want to wrap in target . Define an object with functions as properties in handler . The functions defined in the object determine the behavior when operations on the Proxy are performed. If you want to call the original behavior before wrapping within handler , call an object
Continue reading on Dev.to JavaScript
Opens in a new tab


