uhm, you might be slightly behind current specs ... these changed proxy
quite a lot so that first argument is the target, and second argument is
the behavior.
var myProxy = new Proxy(target, handler);
at least that's how Firefox implemented it right now :D
var
target = {test:123},
proxy = new Proxy(target, {
get: function ($target, key) {
alert($target === target); // true
return $target[key];
}
})
;
alert(proxy.test); // 123
On Mon, Jan 14, 2013 at 9:32 PM, Dmitry Soshnikov <
[email protected]> wrote:
> 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
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss