You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
So, we can review this example by copy and paste.
Current status for this example for latest Chrome, Node.js and Firefox is the following:
otherField will follow to the Proxy trap
someField will not be handled by Proxy trap
And I wonder why it is made like this?
I assume this was not fully described, and as class fields are still in testing phase, the hidden mechanics of how they work indeed just skipped for Proxy traps. The other scenario is that someField is defined using Object.defineProperty or something like this. I can understand if we will keep this behavior. However TypeScript, for example, moves someField declaration to the constructor. And that means though keeping the same conditions for Proxies.
The text was updated successfully, but these errors were encountered:
wentout
changed the title
Proxy in Prototype Chain
Proxy nested inside of the Prototype Chain
Apr 19, 2021
Class fields are stage 4, as of today, and have been shipped in browsers for quite awhile - not in any "testing phase".
Private fields are like internal slots on builtins - they do not, by design, tunnel through Proxies. Public fields, however, should trigger proxy traps all the same, and in your example, the issue isn't about Proxy at all - it's that class fields use [[Define]] semantics, and thus, do not trigger setters on the prototype chain (also by design).
Hi!
Sorry, if this is something already discussed, give me a link please.
Let assume situation there is a nested Proxy in prototype chain.
So, we can review this example by copy and paste.
Current status for this example for latest Chrome, Node.js and Firefox is the following:
otherField
will follow to the Proxy trapsomeField
will not be handled by Proxy trapAnd I wonder why it is made like this?
I assume this was not fully described, and as class fields are still in testing phase, the hidden mechanics of how they work indeed just skipped for Proxy traps. The other scenario is that
someField
is defined usingObject.defineProperty
or something like this. I can understand if we will keep this behavior. However TypeScript, for example, movessomeField
declaration to the constructor. And that means though keeping the same conditions for Proxies.The text was updated successfully, but these errors were encountered: