container-ts
Lightweight decorator-based Dependency Injection container for Typescript and ES7.
Features
- Dependency Injection via ES6 Decorators
- Container lifecycle management
API
Container // decorators
Usage
; MainClass ; container.addnew MainClass;container.addnew DependencyClass1, 'elementId';container.addnew DependencyClass2; container.addnew CtorDependency1, 'ctorDependency1';container.addnew CtorDependency2, 'ctorDependency2'; container.get'elementId'; // returns the instance of DependencyClass1 added as 'elementId' container.getDependencyClass2; // returns the DependencyClass2 instance container.init; // output: "Hello! container.destroy; // output: "destroy"