0.0.4 • Published 6 years ago

omusubi v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
6 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

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago