Created
May 22, 2018 14:42
-
-
Save WebReflection/694940dbdf56ab1390d11aa393c25419 to your computer and use it in GitHub Desktop.
A proxy with a handler.proxy always available.
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 = (target, handler) => { | |
handler = typeof handler === 'object' ? | |
Object.create(handler) : new handler; | |
return (handler.proxy = new Proxy(target, handler)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment