Js Ioc Container Save

A basic IoC Container written in JavaScript

Project README

IoC Container for JavaScript

This script is an example of a basic IoC container in JavaScript.

Read the full article on Medium: Creating an IoC Container with dependency injection in JavaScript - https://medium.com/the-everyday-developer/creating-an-ioc-container-with-dependency-injection-in-javascript-9db228d34060

Register classes

const container = new Container()

container.register('config', {key:value})
container.register('downloader', Downloader, ['config']) 
container.singleton('logger', Logger, ['config'])

Retrieve classes from container

container.get('downloader') // New download instance with config injected in constructor 
container.get('logger') // Logger instance
container.get('logger') // Same logger instance

Run test

npm install
npm test
Open Source Agenda is not affiliated with "Js Ioc Container" Project. README Source: khlbrg/js-ioc-container
Open Issues
Last Commit
2 years ago

Open Source Agenda Badge

Open Source Agenda Rating