1 2 var myobject = new Proxy({3 name: "fulanez",4 age: 33,5 }, {6 get: function (oTarget, sKey) {7 alert ( sKey);8 return oTarget[sKey] || oTarget.getItem(sKey) || undefined;9 },10 set: function (oTarget, sKey, vValue) {11 console.log('set', oTarget, sKey, vValue);12 if (sKey in oTarget) { return false; }13 return oTarget.setItem(sKey, vValue);14 },15 });16 myobject.age++;17 18
Enlace
El enlace para compartir es: