Skip to content

Instantly share code, notes, and snippets.

@Robitx
Forked from WebReflection/proxy.js
Created August 8, 2021 19:56
Show Gist options
  • Save Robitx/53fd0ee671e7349d3344b4fe46c4b37c to your computer and use it in GitHub Desktop.
Save Robitx/53fd0ee671e7349d3344b4fe46c4b37c to your computer and use it in GitHub Desktop.
A proxy with a handler.proxy always available.
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