Is there a way to figure out if the property being read of a proxy object is the final property or the intermediate property.
var handler = {
get(target, key) {
return new Proxy(target[key], handler)
},
set (target, key, value) {
target[key] = value;
return true
}
}
var proxyObject = new Proxy({}, handler);
Now if I am reading a property proxyObject.a.b.c.d
, the get handler would be invoked 4 times, once for each property.
Is there a way for me to figure out when the get is fired for the d
property and when the get is fired for some intermediate property like a
or b