Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created November 12, 2017 18:21
Show Gist options
  • Save gskachkov/b477bf45500cf28f5ea06e7f3eb2303e to your computer and use it in GitHub Desktop.
Save gskachkov/b477bf45500cf28f5ea06e7f3eb2303e to your computer and use it in GitHub Desktop.
const { proxy, revoke } = Proxy.revocable({ id: "foo"}, {
get: function(target, property) {
console.log(`get:${property}:${target[property]}`);
return target[property];
}
});
proxy.id; // get:id:foo
revoke();
proxy.id; // TypeError: Cannot perform 'get' on a proxy that has been revoked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment