0.0.4 • Published 4 years ago

omusubi v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

omusubi

DI Container for JavaScript.

how to use.

※Required decorator.

import { register, inject } from "omusubi";

function main() {
    register(new Child()).as(Child);
    const parent = new Parent();

    parent.callChild(); 
}
main();

abstract class Injectable {
    abstract foo();
}

class Child implements Injectable {
    foo() {
        console.log("foo");
    }
}

class Parent {
    @inject(Injectable)
    child!: Injectable;

    callChild() {
        this.child.foo();
    }
}
0.0.4

4 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago