Created
November 12, 2017 18:21
-
-
Save gskachkov/b477bf45500cf28f5ea06e7f3eb2303e 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 { 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