Created
March 15, 2022 13:46
-
-
Save lawvs/e26c46467d08e9ad4b4692168fde604f to your computer and use it in GitHub Desktop.
proxy log
This file contains 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 target = {}; | |
globalThis.original = target; | |
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy | |
const proxyObj = new Proxy(target, { | |
get(target, prop, receiver) { | |
console.log("GET", target, prop, receiver); | |
return Reflect.get(target, prop, receiver); | |
}, | |
set(target, prop, val, receiver) { | |
console.log("SET", target, prop, val, receiver); | |
return Reflect.set(target, prop, val, receiver); | |
}, | |
apply(target, thisArg, argumentsList) { | |
console.log("APPLY", target, thisArg, argumentsList); | |
return Reflect.apply(target, thisArg, argumentsList); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment