1.0.6 • Published 4 years ago

dependency-injection-v1 v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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.

License

MIT

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago