Created
November 14, 2017 21:54
-
-
Save gskachkov/cb60239b959dd2f288e16d65d873a52f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { id: "foo", name: "boo" }; | |
const proxy = new Proxy(obj, { | |
get: function (target, prop) { | |
console.log(`Access to property: ${prop}`); | |
return Reflect.get(target, prop); | |
} | |
}); | |
proxy.id; // Access to property: id | |
proxy.name; // Access to property: name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment