Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

legacy-es6-proxy-polyfill

ambit-tsai21Apache-2.02.2.0

Proxy polyfill based on ES3 supports IE8, Node.js, etc.

proxy, es6-proxy, proxy-polyfill, polyfill, ie8

readme

简体中文 | English

ES6 Proxy Polyfill  Version

一个 ES6 Proxy 的兼容库,支持 IE6+ 和 Node.js 等。

迄今为止,它支持比 GoogleChrome proxy-polyfill 更多的特性。

该 polyfill 只支持有限的 'trap' 代理:

  • get
  • set
  • apply
  • construct

Proxy.revocable 方法也被支持,但只限于调用上面的 'trap' 。

安装

npm i -S es6-proxy-polyfill

用法

  1. 浏览器:
    <!--[if lte IE 8]>
    <script src="path/to/object-defineproperty-ie.js" type="text/javascript"></script>
    <![endif]-->
    <script src="path/to/es6-proxy-polyfill.js" type="text/javascript"></script>
    <script type="text/javascript">
     var proxy = new Proxy({}, {});
    </script>
  2. Node.js: `javascript var Proxy = require('es6-proxy-polyfill');

var proxy = new Proxy({}, {}); `

注意

  1. 对于非数组对象,想要代理的属性必须在创建时就已存在
  2. 在 IE8 及以下,它依赖于 "object-defineproperty-ie" 库提供的 Object.definePropertiesObject.getOwnPropertyDescriptor
  3. Trap 的支持情况:

||对象|函数|数组| |:-:|:-:|:-:|:-:| |>=IE9|get, set|get, set, apply, construct|get, set| |<=IE8|get, set|apply, construct|-|

测试

  1. 使用浏览器访问 test/browser/index.html
  2. 已在 IE6-8、IE11 中进行测试

联系

  1. 微信: ambit_tsai
  2. QQ群: 663286147
  3. 邮箱: ambit_tsai@qq.com