omusubi
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.4 • Public • Published

    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();
        }
    }

    Keywords

    none

    Install

    npm i omusubi

    DownloadsWeekly Downloads

    0

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    8.28 kB

    Total Files

    9

    Last publish

    Collaborators

    • kojiro.ueda