mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-29 13:52:22 +00:00
docs(proxy): edit proxy
This commit is contained in:
parent
5a34395c74
commit
3619d2121c
@ -637,7 +637,7 @@ proxy.foo = 'bar'
|
|||||||
|
|
||||||
### getOwnPropertyDescriptor()
|
### getOwnPropertyDescriptor()
|
||||||
|
|
||||||
`getOwnPropertyDescriptor`方法拦截`Object.getOwnPropertyDescriptor`,返回一个属性描述对象或者`undefined`。
|
`getOwnPropertyDescriptor`方法拦截`Object.getOwnPropertyDescriptor()`,返回一个属性描述对象或者`undefined`。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var handler = {
|
var handler = {
|
||||||
@ -662,13 +662,13 @@ Object.getOwnPropertyDescriptor(proxy, 'baz')
|
|||||||
|
|
||||||
### getPrototypeOf()
|
### getPrototypeOf()
|
||||||
|
|
||||||
`getPrototypeOf`方法主要用来拦截`Object.getPrototypeOf()`运算符,以及其他一些操作。
|
`getPrototypeOf`方法主要用来拦截获取对象原型。具体来说,拦截下面这些操作。
|
||||||
|
|
||||||
- `Object.prototype.__proto__`
|
- `Object.prototype.__proto__`
|
||||||
- `Object.prototype.isPrototypeOf()`
|
- `Object.prototype.isPrototypeOf()`
|
||||||
- `Object.getPrototypeOf()`
|
- `Object.getPrototypeOf()`
|
||||||
- `Reflect.getPrototypeOf()`
|
- `Reflect.getPrototypeOf()`
|
||||||
- `instanceof`运算符
|
- `instanceof`
|
||||||
|
|
||||||
下面是一个例子。
|
下面是一个例子。
|
||||||
|
|
||||||
@ -727,7 +727,7 @@ Object.isExtensible(p) // 报错
|
|||||||
|
|
||||||
### ownKeys()
|
### ownKeys()
|
||||||
|
|
||||||
`ownKeys`方法用来拦截以下操作。
|
`ownKeys`方法用来拦截对象自身属性的读取操作。具体来说,拦截以下操作。
|
||||||
|
|
||||||
- `Object.getOwnPropertyNames()`
|
- `Object.getOwnPropertyNames()`
|
||||||
- `Object.getOwnPropertySymbols()`
|
- `Object.getOwnPropertySymbols()`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user