-
Notifications
You must be signed in to change notification settings - Fork 0
/
NOTES.TXT
42 lines (31 loc) · 814 Bytes
/
NOTES.TXT
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
}*/
function wrap(obj){
// obj.fullName2.bind(compu)
Reflect.ownKeys(obj).forEach((key)=>{
console.log(obj[key])
var descriptor = (Reflect.getOwnPropertyDescriptor(obj, key))
if (Array.isArray(descriptor.value)){
if (descriptor.value[0] === 'proxyo_computed'){
descriptor.value = descriptor.value[1].call(obj)
Reflect.defineProperty(obj,key,descriptor)
}
}
})
return obj
}
function compu (fn) {
return ['proxyo_computed',fn]
}
var user = {
firstName: "Michel",
lastName: "Weststrate",
get fullName2 (){
return this.firstName + " " + this.lastName
},
fullname3 :function(){
return 'ha'
}(),
fullName: compu(function(){
//return this.firstName + " " + this.lastName
})
}