0

I believe I've read that the upcoming ES6 definition enables calling custom definable methods when an object property is set, updated or deleted. However, I can't find the blogpost anymore to back that up.

Is this correct? I believe this functionality was called 'proxy', although I can't find anything conclusive.

Moreover, would this be available now using es6-shim? ( https://github.com/paulmillr/es6-shim) Perhaps I'm looking for the new Map-functionality, but again I'm unsure.

Anyone can point me to a definitive pointer?

Charles
  • 48,924
  • 13
  • 96
  • 136
Geert-Jan
  • 16,760
  • 10
  • 68
  • 121

1 Answers1

0

Yes, it is Proxy. It is available right now in Firefox.

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Proxy

Though I do not know if its semantics match that of the proposed ES-6 Proxy.

http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies

To test the proposed standard, this is currently implemented in Chrome, but you need to enable the "experimental" features.

There are some high-level descriptions of new features being documented here, http://tc39wiki.calculist.org/es6/ but it is a work in progress.

  • Thanks. Although I didn't say it explicitly (only in the tags) I intend to use it in Node. Any idea if this is supported? (perhaps again using es6-shim? ) – Geert-Jan Sep 08 '12 at 19:16
  • @Geert-Jan: I think I've heard of people using Proxy in NodeJS. Pretty sure you'll just need to enable it in V8. I just found [this question](http://stackoverflow.com/questions/10665892/enable-harmony-proxies-in-nodejs) that seems to give a solution. EDIT: And I just tested it, and the global `Proxy` object does appear when you do `> node --harmony-proxies` as suggested by that answer. – gray state is coming Sep 08 '12 at 19:22