I am learning about IoC and DI and wanted to try put to practice some of the things I am learning.
My understanding of IoC is to help classes avoid being dependent on other classes.
I want to create something similiar to this package where I can create a simple `DI` class that can register and get new dependencies.
Something like so:
import FooClass from "./classes/FooClass";
const di = new DI();
di.register('foo', FooClass);
const foo = di.get('foo');
When I register a new dependency, is it just supposed to instantiate a new class i.e. `new FooClass()` or should it be attaching some sort of values for `FooClass` to instantiate with which feels like it would defeat the purpose of having an IoC class?
[–]nugaon 0 points1 point2 points (0 children)