Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Last active November 8, 2017 17:06
Show Gist options
  • Save gskachkov/f046807144ec67f858b9a43e376d8c37 to your computer and use it in GitHub Desktop.
Save gskachkov/f046807144ec67f858b9a43e376d8c37 to your computer and use it in GitHub Desktop.
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