instance-caching-factory.js 256 B

123456789
  1. export default function instanceCachingFactory(factoryFunc) {
  2. let instance;
  3. return (dependencyContainer) => {
  4. if (instance == undefined) {
  5. instance = factoryFunc(dependencyContainer);
  6. }
  7. return instance;
  8. };
  9. }