0.0.4-dev • Published 7 months ago
@khapu2906/cosmos v0.0.4-dev
This package was developed to provide a simple and flexible Inversion of Control (IoC) container for TypeScript projects.
Install
npm install @khapu2906/cosmos
#or
yarn add @khapu2906/cosmosUsage
Importing Modules
import { Container } from "@khapu2906/cosmos";Initializing the Container
To initialize the container, create an instance of the Container class:
const container = new Container();Binding Services
You can bind services to the container using the bind method:
container.bind('myService', () => new MyService());Resolving Services
You can resolve services from the container using the get method:
const myService = container.get('myService');Author
More
Modules
License
IoC is open-sourced software licensed under the MIT license.