counter-factory-demo /

Filename Size Date modified Message
1.1 KB
156 B
176 B
122 B
274 B
274 B
156 B
436 B
234 B


Demos issues to consider when creating a NodeJS factory.


For usage details see the article NodeJS Module Factories:


  • counter.js - a demo counter module
  • test-one.js - demo using just one instance of the counter module
  • test-two.js - demo what can go wrong when two instances of the counter are declared
  • bad-factory.js - demo of a factory module strategy that will fail
  • test-bad-factory.js - demo the issues with the bad factory module
  • counter-factory.js - demo of a factory module that should work as expected
  • test-factory.js - demo the factory module in usage
  • test-two-factories.js - demo how factory still works for multiple instances