JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 863
  • Score
    100M100P100Q101174F
  • License Apache-2.0

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

Package Exports

  • es6-proxy-polyfill

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (es6-proxy-polyfill) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

[ 中文 ]

ES6 Proxy Polyfill

This is a polyfill for the Proxy constructor based on ES3 supports IE8 , Node.js, etc.

Refer to ECMAScript, and this has no external dependencies.

Due to the limitations of ES3, the polyfill supports just a limited number of proxy 'traps':

  • apply
  • construct

Installation

  1. Use NPM: npm install es6-proxy-polyfill
  2. Download directly: Development Version, Production Version

Usage

  1. Browser:
<script src="path/to/es6-proxy-polyfill.js" type="text/javascript"></script>
<script type="text/javascript">
    var target = function(){/* code */};
    var handler = {/* code */};
    var proxy = new Proxy(target, handler);
</script>
  1. Node.js:
require('es6-proxy-polyfill');

var target = function(){/* code */};
var handler = {/* code */};
var proxy = new Proxy(target, handler);

Notice

  1. In ES6, the access to Proxy object's properties will be passed to target. In order to simulate this feature, polyfill will try to copy properties from target by using Object.assign method, so it's better to load an Object.assign polyfill first;
<script src="path/to/babel-polyfill.js" type="text/javascript"></script>
<script src="path/to/es6-proxy-polyfill.js" type="text/javascript"></script>
  1. The code has been tested on Node.js 0.10.48 and IE8, and it may work in other environments too.