README.md

Installation

In a browser, after loading

<script src="reflect.js"></script>

a global object Reflect is defined that contains reflection methods as defined in the ES6 draft.

If your browser supports the "harmony-era" Proxy object that predates ES6 (i.e. Firefox or Chrome), that Proxy object is also updated to follow the latest direct proxiesspec. To create such a proxy, call:

Note: Chrome v38 seems to have removed
the Proxy constructor. As a result, this library cannot patch the harmony-era Proxy object on
Chrome v38. If you're working with chromium directly, it's still possible to enable proxies using
chromium-browser --js-flags="--harmony_proxies".

You can also run the code in one of the following headless JavaScript shells:

Proxy Handler API

The sister project proxy-handlers
defines a number of predefined Proxy handlers as "abstract classes" that your
code can "subclass" The goal is to minimize the number of traps that your proxy
handlers must implement.

Spec Compatibility

In ES6, Proxy will be a constructor function that will require the use
of new. That is, you must write new Proxy(target, handler). This library
exports Proxy as an ordinary function which may be called with or without using the new operator.

Array.isArray(obj) and [].concat(obj) are patched so they work
transparently on proxies-for-arrays (e.g. when obj is new Proxy([],{})).
The current ES6 draft spec does not treat proxies-for-arrays as genuine
arrays for these operations. Update (Nov. 2014): it looks like the ES6 spec will change so that Array.isArray and other methods that test for arrayness will work transparently on proxies, so this shim's behavior will become the standardized behavior.