domenic at domenicdenicola.com (2013-10-26T03:14:06.656Z)
Follow up question for Tom et al...
Using `require('harmony-reflect')`....
```js
var t = {a:3, c:4};
var p = Proxy(
t,
{
get: function() {},
delete: function(t,x) {
console.log('deleting');
delete t.a;
}
}
);
delete p.c
p; //{a:3}
t; //{a:3}
```
the console.log is not called and deleting is not trapped.
Am I doing something wrong?
Follow up question for Tom et al... Using require('harmony-reflect').... var t = {a:3, c:4}; var p = Proxy( t, { get: function() {}, delete: function(t,x) { console.log('deleting'); delete t.a; } } ); delete p.c p; //{a:3} t; //{a:3} the console.log is not called and deleting is not trapped. Am I doing something wrong? @angustweets On Fri, Oct 18, 2013 at 12:33 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote: > Proxy.create and Proxy.createFunction are deprecated. > > The correct syntax is `new Proxy(target, handler)` > > In my original direct proxies proposal, the `new` was optional, so that > `var p = Proxy(target, handler)` works equally well (cf. < > http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies>) > > Since then, it seems people want to move away from implicit construction > (since it doesn't interact well with class inheritance), so I don't know if > there is still consensus on this. > > In the prototype Firefox implementation, `new` is currently mandatory. > > Regards, > Tom > > > 2013/10/18 Angus Croll <anguscroll at gmail.com> > >> I couldn't find a commitment to a specific syntax in the latest ES6 >> standard >> >> Gecko, chrome experimental, traceur and 'node --harmony-proxies' support >> the Proxy.create syntax (detailed in >> http://wiki.ecmascript.org/doku.php?id=harmony:proxies) >> >> e.g. >> var proxy = Proxy.create({ >> get: function(p, n) { >> return 'Hello ' + n; >> } >> }); >> proxy.World //'Hello World' >> >> However MDN calls the above the 'Old Proxy API'. >> Gecko also supports what MDN indicates implies is the current Proxy >> syntax (i.e. new Proxy) >> e.g. >> >> var p = new Proxy( >> {}, >> {get: function(p,x) { >> return 'Hello ' + x >> }} >> ); >> p.World; //'Hello World' >> >> Which is right? >> thanks >> >> >> @angustweets >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss at mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131018/e83cceeb/attachment.html>