Giter Club home page Giter Club logo

harmony-reflect's Introduction

This is a shim for the ECMAScript-Harmony reflection module.

In a browser, after loading

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

a global object Reflect is defined that contains the functions from the ES-Harmony reflect module (see below).

The Proxy object is also updated to follow the latest direct proxies spec. To create such a proxy, call:

var proxy = Proxy(target, handler)

If you are using node.js (>= v0.7.8), you can install via npm:

npm install harmony-reflect

Then:

node --harmony
> require('harmony-reflect');

API

This module exports a single object named Reflect. See the Reflect API and Handler API docs for details.

Compatibility

The Reflect API, with support for proxies, was tested on:

  • Firefox 12 (should work since Firefox 4)
  • Chrome 19, under an experimental flag
  • spidermonkey shell
  • v8 --harmony (on 3.11.0, should work since at least v3.6)
  • node --harmony (in node v0.7.8)

Dependencies

  • ECMAScript 5/strict
  • To emulate direct proxies: * old Harmony Proxies * Harmony WeakMaps

After loading reflect.js into your page or other JS environment, be aware that the following globals are patched to be able to recognize emulated direct proxies:

Object.{freeze,seal,preventExtensions}
Object.{isFrozen,isSealed,isExtensible}
Object.getPrototypeOf
Object.prototype.valueOf
Object.getOwnPropertyDescriptor
Function.prototype.toString
Date.prototype.toString
Proxy

Issues

See the list of open issues.

Next steps

  • Provide fallback behavior for part of the API, for environments without Proxy or WeakMap support.
  • More tests.
  • Switch to qunit or other unit testing framework.
  • Add example uses of proxies.
  • More detailed API description.

harmony-reflect's People

Contributors

polotek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.