ES6 learning Summary 7: What is a Proxy?

What is a Proxy? Modify the default behavior of some operations.

Avatar: can be understood as one interception before setting the target object, outside access to the object, this layer must first pass interception, thus providing a mechanism to filter and rewrite access to the outside world.

Still do not understand? Then take a concrete scenario: We want to buy foreign goods, it may need to find purchasing, purchasing abroad after buy merchandise, then return to turn to you. In this scenario, purchasing acts as the agent for the purchase, which is the proxy constructor play a role.

Parametric form:

image

method:

image

:( scenarios form validation)

image

https://segmentfault.com/a/1190000019198822

https://www.cnblogs.com/kdcg/p/9145385.html

Guess you like

Origin www.cnblogs.com/hxw1024/p/12134245.html