Suppose I have an object view
. I have a reference to it but I don't control how it's being initialized. It has a property mode
. I need to know where from this property is modified for debugging purposes. Since object mutation observer
didn't make it to the spec, what are the options now?
I'm thinking two options:
- Modify property descriptor to add setter/getter dynamically (requires property being
configurable: true
). - Use
proxy
object to intercept value write (requires I substitute original object with proxy during creation)
Are there any other ones I haven't thought of?