Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 2.65 KB

environment.md

File metadata and controls

37 lines (25 loc) · 2.65 KB

Environment support and polyfills

InversifyJS requires a modern JavaScript engine with support for the Promise, Map, Metadata Reflection API and Proxy objects. If your environment don't support one of these you will need to import a shim or polyfill.

Metadata Reflection API

Required always. Use reflect-metadata as polyfill.

$ npm install reflect-metadata

reflect-metadata will be automatically imported by inversify. This will create the Reflect object as a global.

Map

Maps 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).

Promise

Promises are required if you want to:

Inject a provider or inject dynamic values asynchronously.

Handle post construction and activation, or pre destroy and deactivation asynchronously.

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 or bluebird).

Proxy

Proxies are only required only if you want to inject a proxy.

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 as polyfill to run our unit tests.