3.0.0 • Published 3 years ago

@tobes31415/dependency-injection v3.0.0

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

DI

A tiny library to handle basic dependency injection

View API Docs

Installation

npm install --save @tobes31415/di

Basic Useage

import { DI } from "@tobes31415/dependency-injection";
import { SomeService } from "./someService";

class SomeClass {
    constructor() {
        this.service = DI.resolve(SomeService);
    }
}

Advanced Useage

DI.useClass(Potato, Carrot);
const obj = DI.resolve(Potato) // instance of Carrot

DI.useObject(Potato, {banana});
const obj = DI.resolve(Potato) // {banana}

DI.useFactory(Potato, () => 123);
const obj = DI.resolve(Potato) //123
3.0.2

1 year ago

3.0.1

1 year ago

2.0.1

1 year ago

3.0.0

3 years ago

2.0.0

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago