injector
TypeScript Dependency Injection using reflect-metadata
and typescript 1.7+ with es7 experimental features enabled
How it works
The purpose of this module is to allow you to do something like that:
// MyClass.ts; // Foo.tsdeclare
And then create the instance of MyClass and inject the instance of Foo at runtime:
// test.ts;;; // create the real Foo class // instantiate the injector;// register an instance of FooImpl to be bind with people asking for @Inject("Foo")injector.register'Foo', new FooImpl; // create an instance of MyClass;// inject the needed dependenciesinjector.injectc; // now you can callc.doFoo;// prints "foo bar"
Dev env
Init the project:
npm install
Compile TypeScript:
npm run build
Run the tests
npm test