Sapphire IOC
This is a simple IOC container implementation on NodeJS. You can register services on it and retrieve it later.
Register with bind
You can register a service using the bind
method and passing a callback on how the service should build when is accessed later. The IOC container will always create a new instance when the ioc.make()
is executed.
// SimpleClass.js { this_parameter = parameter } { return this_parameter } { this_parameter = parameter } moduleexports = SimpleClass
const IOC = const SimpleClass = let ioc = iocconst simpleClass = ioc
Register with singleton
const IOC = const SimpleClass = let ioc = iocconst simpleClass = iocconst simpleClass2 = ioc simpleClasssimpleClass2 // 3
License
MIT