mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-28 21:32:20 +00:00
Update proxy.md
this问题中添加对handler.construct钩子函数中this的描述
This commit is contained in:
parent
9f1f925fc1
commit
48e318b12b
@ -1053,6 +1053,8 @@ proxy.foo // TypeError: Revoked
|
||||
|
||||
## this 问题
|
||||
|
||||
正常情况下,Proxy代理的钩子函数中的`this`指向的是Proxy代理实例(construct钩子函数除外,该钩子函数中`this`指向的是handler)
|
||||
|
||||
虽然 Proxy 可以代理针对目标对象的访问,但它不是目标对象的透明代理,即不做任何拦截的情况下,也无法保证与目标对象的行为一致。主要原因就是在 Proxy 代理的情况下,目标对象内部的`this`关键字会指向 Proxy 代理。
|
||||
|
||||
```javascript
|
||||
|
Loading…
x
Reference in New Issue
Block a user