Last active
November 8, 2017 17:06
-
-
Save gskachkov/f046807144ec67f858b9a43e376d8c37 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
class A { | |
constructor (value) { this.value = value; } | |
getValue() { return this.value; } | |
} | |
const proxiedClass = new Proxy(A, { | |
construct: function(target, [ first ], newTarget) { | |
return new target(first + ":proxy-value"); | |
} | |
}); | |
const obj = new proxiedClass("foo"); | |
console.log(obj.getValue()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment