Singleton
A class of which only a single instance can exist.
A class has only one instance and provides a global point of access.
It's usage is high in javascript libraries.
It limits the number of instance of particular object to one, a single instance called as singleton.
Reduces the need for global variables because it limits namespace collision and associated risk of name collision.
Module pattern is manifestation(a symptom) of singleton pattern.
Several other patterns, such as, Factory, Prototype, and Facade are frequently implemented as Singletons when only one instance is needed.
Last updated
Was this helpful?