1.0.0 • Published 6 years ago

simple-dependency-injector v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Use decorators to manage dependency injection in you TS and JS projects

Installation

npm install simple-dependency-injector --save
yarn add simple-dependency-injector

this module need experimentalDecorators enabled

Usage

Use @Injectable to declare an injectable object.

Use @Inject([<injectable constructor>,]) to inject declared injectable into a function.

TypeScript

import {Injectable, Inject} from "simple-dependency-injector";

@Injectable
class MyInjectable {
    //some code
}

@Inject([MyInjectable])
class WhoNeedMyInjectable {
    constructor(private myInjectable: MyInjectable) {
        //use MyInjectable with this.myInjectable
    }
}

Javascript

import {Injectable, Inject} from "simple-dependency-injector";

@Injectable
class MyInjectable {
    //some code
}

@Inject([MyInjectable])
class WhoNeedMyInjectable {
    constructor(myInjectable) {
        this.myInjectable = myInjectable;
        //use MyInjectable with this.myInjectable
    }
}

Test

npm run test
1.0.0

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago