MyObj = new Proxy({}, {//Proxy ES6中的方法
get: function (target, name, receiver) {
var temp = target[name];
console.log('You are gettting: ' + name);
return temp;
}, set: function (target, name, value) {
target[name] = value;
console.log('You are setting: ' + name);
console.log('Value is: ' + value);
}
});
var testObj = new Object(MyObj);
testObj.hi = 'Hello' |
|