Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. function Singleton() {
  2.  
  3. if(typeof Singleton.instance === "object") {
  4. return Singleton.instance; //accessible from outside
  5. }
  6.  
  7. //do something...
  8.  
  9. Singleton.instance = this;
  10.  
  11. //imply return this object
  12. //return this;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement