Skip to content

Commit

Permalink
[docs] Map is now required (#400)
Browse files Browse the repository at this point in the history
* es6 map & small typo

* map is now required

* no need to call it es6 ...
  • Loading branch information
goenning authored and remojansen committed Nov 4, 2016
1 parent 2806aa9 commit f429ddc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -82,6 +82,7 @@ compilation options in your `tsconfig.json` file.
InversifyJS requires a modern JavaScript engine with support for:

- [Reflect metadata](https://github.com/rbuckton/ReflectDecorators/blob/master/spec/metadata.md)
- [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) (Only required if using [provider injection](https://github.com/inversify/InversifyJS#injecting-a-provider-asynchronous-factory))
- [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) (Only required if using [activation handlers](https://github.com/inversify/InversifyJS/blob/master/wiki/activation_handler.md))

Expand Down
14 changes: 10 additions & 4 deletions wiki/environment.md
Expand Up @@ -2,14 +2,15 @@

InversifyJS requires a modern JavaScript engine with support for the
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise),
[Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map),
[Metadata Reflection API](http://rbuckton.github.io/ReflectDecorators/#reflect) and
[Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) objects.
If your environment don't support one of these you will need to import a shim or polypill.
If your environment don't support one of these you will need to import a shim or polyfill.

## Metadata Reflection API
> :warning: **The `reflect-metadata` polyfill should be imported only once in your entire application** because the Reflect object is mean to be a global singleton. More details about this can be found [here](https://github.com/inversify/InversifyJS/issues/262#issuecomment-227593844).
Required always. Use [reflect-metadata](https://www.npmjs.com/package/reflect-metadata) as polypill.
Required always. Use [reflect-metadata](https://www.npmjs.com/package/reflect-metadata) as polyfill.

```
$ npm install reflect-metadata
Expand All @@ -36,13 +37,18 @@ If you are working in a web browser you can use a script tag:

This will create the Reflect object as a global.

## Map
[Maps](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) are required when using InversifyJS 3 or higher.

Most modern JavaScript engines support map but if you need to support old browsers you will need to use a map polyfill (e.g. [es6-map](https://www.npmjs.com/package/es6-map)).

## Promise
Promises are only required only if you use want to
[Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) are only required only if you use want to
[inject a provider](https://github.com/inversify/InversifyJS#injecting-a-provider-asynchronous-factory).

Most modern JavaScript engines support promises but if you need to support old browsers you will need to use a promise polyfill (e.g. [es6-promise](https://github.com/stefanpenner/es6-promise) or [bluebird](https://www.npmjs.com/package/bluebird)).

## Proxy
ES6 proxies are only required only if you want to [inject a proxy](https://github.com/inversify/InversifyJS/blob/master/wiki/activation_handler.md).
[Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) are only required only if you want to [inject a proxy](https://github.com/inversify/InversifyJS/blob/master/wiki/activation_handler.md).

As today (September 2016) proxies are not very well supported and it is very likely that you will need to use a proxy polyfill. For example, we use [harmony-proxy](https://www.npmjs.com/package/harmony-proxy) as polyfill to run our unit tests.

0 comments on commit f429ddc

Please sign in to comment.