1.0.6 • Published 4 years ago
dependency-injection-v1 v1.0.6
dependency-injection-v1
dependency-injection-v1 is a JS/TS library for dealing with Dependency Injection.
Installation
Use the package manager npm to install dependency-injection-v1.
npm install dependency-injection-v1
Usage
import { Injectable, Inject } from 'dependency-injection-v1';
@Injectable
class A {
public getUser() {
return {
username: 'lekato',
message: 'easy but good',
};
}
}
class B {
@Inject(A) propertyA: A;
public showUserMessage() {
const user = this.propertyA.getUser();
console.log(`${user.username} said: ${user.message}`);
}
}
const b = new B();
b.showUserMessage();
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.