JSPM

  • Created
  • Published
  • Downloads 209
  • Score
    100M100P100Q87042F
  • License MIT

A Dependency-Injection container that holds services and can produce instances of them as required. It mimics reflection by parsing the app at compile-time and supporting the generic-reflection syntax.

Package Exports

  • @wessberg/di

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 (@wessberg/di) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DI (Dependency Injector) NPM version

A Dependency-Injection container that holds services and can produce instances of them as required. It mimics reflection by parsing the app at compile-time and supporting the generic-reflection syntax.

Installation

Simply do: npm install @wessberg/di.

Usage

import {DIContainer} from "@wessberg/di";
DIContainer.registerSingleton<IFoo, Foo>();
DIContainer.registerTransient<IBar, Bar>();
DIContainer.get<IBar>(); // Retrieves a concrete instance of the IBar service.

// And so on...

Changelog:

v1.0.4:

  • Bumped CodeAnalyzer dependency.

v1.0.3:

  • Upgraded to newest version of 'CodeAnalyzer' and refactored all around.

v1.0.1:

  • Fixed a bug where 'hasAltered' would always be false. Cleanup. Added typings to .gitignore and .npmignore.

v1.0.0:

  • First release.