-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Proxy_6.html
52 lines (46 loc) · 1.37 KB
/
Proxy_6.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var doc = new Proxy({}, {
"get": function (oTarget, sKey) {
console.log('get')
return oTarget[sKey]
return Reflect.get(oTarget, sKey);
},
"set": function (oTarget, sKey, vValue) {
console.log('set')
return Reflect.set(oTarget, sKey, vValue);
},
"deleteProperty": function (oTarget, sKey) {
console.log('deleteProperty')
},
"enumerate": function (oTarget, sKey) {
console.log('enumerate')
},
"ownKeys": function (oTarget, sKey) {
console.log('ownKeys')
},
"has": function (oTarget, sKey) {
console.log('has')
console.log(oTarget)
console.log(sKey)
return oTarget[sKey]
},
"defineProperty": function (oTarget, sKey, oDesc) {
console.log('defineProperty')
},
"getOwnPropertyDescriptor": function (oTarget, sKey) {
console.log('getOwnPropertyDescriptor')
},
});
doc.a=10;
console.log(doc.a)
console.log('a' in doc)
</script>
</body>
</html>