0

I want to log every time I set a property on a class. I know this can be done by adding get and set methods for each property explicitly. Is there any way to log when I set properties that I haven't written a setter for?

ambersz
  • 11
  • 2
  • 2
  • 1
    An actual `class`, or just an object? A class is something that you'd call `new` on, eg `new FooBar()`, where `FooBar` is a class – CertainPerformance Jan 02 '20 at 06:49
  • 1
    [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) – adiga Jan 02 '20 at 06:52
  • constructor with arguments in oops try it.you want to intercept means what why just logger? what do you want to do? – ThinkTank Jan 02 '20 at 06:53
  • @CertainPerformance I'm using a class calling new on. Do I need to somehow use Proxy within the constructor? – ambersz Jan 02 '20 at 07:21

0 Answers0