Proxy's optional target

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Mon Jan 14 21:32:08 PST 2013


Hello,

Don't know whether it was mentioned/asked before (sorry if so), but just a note: probably it makes more sense making the target argument as optional and the second one in the Proxy constructor's API.

Proxy(handler[, target]):

1. If target is undefined, let the target be new Object();
...

In this case we'll cover (probably the most used) use-case of direct-proxies:

var p = new Proxy({
  get: function(target, name, value) {
    ...
  }
});

Thanks,
Dmitry


More information about the es-discuss mailing list