1. Mitch Allen
  2. counter-factory-demo

Overview

HTTPS SSH

counter-factory-demo

Demos issues to consider when creating a NodeJS factory.

Usage

For usage details see the article NodeJS Module Factories:

Files:

  • 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

Repo(s)