JasperTack
JasperTack

Reputation: 4447

Chrome javascript Proxy object is not defined

I wanted to experiment with the Proxy object that was introduced in EMCAScript 6, as described in this blogpost: http://ariya.ofilabs.com/2013/07/es6-and-proxy.html

However when I wanted to run the example code:

var engineer = { name: 'Joe Sixpack', salary: 50 };

var interceptor = {
  set: function (receiver, property, value) {
    console.log(property, 'is changed to', value);
    receiver[property] = value;
  }
};

engineer = Proxy(engineer, interceptor);

I got the error that Proxy is not defined. Does anybody know more about the support for proxies in Chrome? I am using Chrome version 33.0.1750.152 on a Mac.

Upvotes: 11

Views: 5355

Answers (4)

brillout
brillout

Reputation: 7444

V8 released full support for Proxy in 4.9

Source; http://v8project.blogspot.de/2016/01/v8-release-49.html

Chrome 49 uses V8 4.9

Upvotes: 2

AnyWhichWay
AnyWhichWay

Reputation: 774

There is a Chrome specific shim for Proxy available at https://github.com/anywhichway/chrome-proxy. If your needs are basic, this should get you by until the v8 team finishes re-implementation.

Upvotes: -1

George Vinokhodov
George Vinokhodov

Reputation: 336

Just start chrome from command line with flag --js-flags="--harmony-proxies" or add it to chrome's shortcut

Upvotes: 1

radia
radia

Reputation: 1486

if you’re using Chrome most of the ES6 features are hidden behind a feature toggle. Browse to chrome://flags, find the section titled “Enable Experimental JavaScript” and enable it to turn on support: chrome://flags/#enable-javascript-harmony

After activation, restart your chrome browser and it should work

Upvotes: 7

Related Questions