1.1.0 • Published 2 years ago

@fraziersoft/di v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Issues Coverage MIT License LinkedIn

About The Project

Automatic dependency injection for TypeScript projects. Supports advanced use cases through easy, flexible configuration.

Getting Started

Prerequisites

Install the reflect-metadata and @fraziersoft/di packages.

  • npm
    npm install -D reflect-metadata @fraziersoft/di
  • yarn
    yarn add -D reflect-metadata @fraziersoft/di

Enable decorator support in your project's tsconfig.json file.

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Example

import 'reflect-metadata';
import { create, Injectable } from '@fraziersoft/di';

class Ninja {
  attack() {
    console.log('The Ninja Attacks!');
  }
}

@Injectable()
class Game {
  constructor(public ninja: Ninja) {}

  play() {
    this.ninja.attack();
  }
}

const app = create(Game);
app.play();

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago