Call overwride on JS is Proxy
JavaScript
class BaseProxy {
constructor() {
return new Proxy(this, {
get(target, propKey) {
console.log("Intercepting call: " + propKey)
const objMethod = target[propKey]
return function (...args) {
let result = objMethod.apply(this, args)
console.log(propKey + JSON.stringify(args)
+ ' -> ' + JSON.stringify(result))
return result
};
}
})
}
testEcho() {
console.log("test")
}
}
var t = new BaseProxy()
t.testEcho()