jfFactory
Simple class factory and registry for making use of dependency injection.
Usage
Dependency injection
console; factory; const factory = Factory; // Or `new Factory()`;factory;; // MyClass //-----------------------------------------------------------------------------// Somebody need modify MyClass behavior and to replace all uses of MyClass//----------------------------------------------------------------------------- console; factory;; // MyOtherClass
Several factories
//-----------------------------------------------------------------------------// Factory for services.//-----------------------------------------------------------------------------const services = Factory;service; //-----------------------------------------------------------------------------// Factory for models.//-----------------------------------------------------------------------------const models = Factory;models; //-----------------------------------------------------------------------------// In other file.//-----------------------------------------------------------------------------const service = Factory;