最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Chrome javascript Proxy object is not defined - Stack Overflow

programmeradmin2浏览0评论

I wanted to experiment with the Proxy object that was introduced in EMCAScript 6, as described in this blogpost: .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.

I wanted to experiment with the Proxy object that was introduced in EMCAScript 6, as described in this blogpost: http://ariya.ofilabs./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.

Share Improve this question asked Apr 11, 2014 at 13:20 JasperTackJasperTack 4,4475 gold badges30 silver badges43 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 7

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

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

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

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

发布评论

评论列表(0)

  1. 暂无评论