I would like to measure time of my all function in my class Foo.
My code is:
class Foo {
constructor() {
return new Proxy(this, {
get(target, prop, receiver) {
console.log(`Calling '${prop}'`);
return target[prop];
},
});
}
myFn() {
console.log('hi');
}
}
new Foo().myFn();
Problem is, that I need to return function from proxy. I tried to use code return () => target[prop](); but it looks like that myFn was not called.
Any tips? Maybe can I achieve it using rxjs lib?