Open zxza opened 5 years ago
let onWatch =(obj,setBind,getLogger)=>{
let handler ={
get(target,property,receiver){
getLogger(target,property);
return Reflect.get(target,property,receiver)
},
set(target,property,value,receiver){
setBind(value,property);
return Reflect.set(target,property,value)
}
}
return new Proxy(obj,handler)
}
let obj={a:1}
let p=onWatch(
obj,
(v,property)=>{
// console.log(${property},${v});
},
(target,property)=>{
console.log('`${property}`=${target[property]}');
}
)
不知道我的这个算不算。。。。。