Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created November 14, 2017 21:54
Show Gist options
  • Save gskachkov/cb60239b959dd2f288e16d65d873a52f to your computer and use it in GitHub Desktop.
Save gskachkov/cb60239b959dd2f288e16d65d873a52f to your computer and use it in GitHub Desktop.
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