A DOM use case that can't be emulated with direct proxies
kpreid at google.com
Wed Dec 12 12:09:29 PST 2012
On Wed, Dec 12, 2012 at 12:03 PM, David Bruant <bruant.d at gmail.com> wrote:
> Le 12/12/2012 20:49, Kevin Reid a écrit :
> I haven't made it public yet, but it's just the obvious implementation
> of an (old-style, as implemented in Firefox/Chrome) proxy with a switchable
> Interesting. As I said, target-switching won't be possible in direct
I understand that direct proxies have an internal “target” object. Will it
not be possible to simply never place any properties on said object (thus
not constrain future behavior) while still appearing to have properties?
This text suggests that is a possible and expected pattern:
Since this Proxy API requires one to pass an existing object as a target to
> wrap, it may seem that this API precludes the creation of fully “virtual”
> objects that are not represented by an existing JSObject. It’s easy to
> create such “virtual” proxies: just pass a fresh empty object as the target
> to Proxy and implement all the handler traps so that none of them
> defaults to forwarding, or otherwise touches thetarget.
In my case there is an actual object, of course, but I implement forwarding
to said object myself; the JS implementation never knows that I am
“treating it as a target”.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss