L
-Lost
Somehow I got lost in an article that led me here:
http://www.javascriptkata.com/2007/04/04/how-to-make-a-singleton/
Having recently seen someone else mentioning a Singleton pattern in JavaScript, I wonder,
like the commenter Aaron, why anyone would use one?
For anyone who doesn't know what a Singleton pattern is, look here:
http://en.wikipedia.org/wiki/Singleton_pattern
"the singleton pattern is a design pattern that is used to restrict instantiation of a
class to one object"
Which basically means we end up with an object that has the ability to restrict itself to
only one instance at a time.
Anyway, I would appreciate any *clear* examples of how one might *require* a Singleton
pattern.
-Lost
http://www.javascriptkata.com/2007/04/04/how-to-make-a-singleton/
Having recently seen someone else mentioning a Singleton pattern in JavaScript, I wonder,
like the commenter Aaron, why anyone would use one?
For anyone who doesn't know what a Singleton pattern is, look here:
http://en.wikipedia.org/wiki/Singleton_pattern
"the singleton pattern is a design pattern that is used to restrict instantiation of a
class to one object"
Which basically means we end up with an object that has the ability to restrict itself to
only one instance at a time.
Anyway, I would appreciate any *clear* examples of how one might *require* a Singleton
pattern.
-Lost