Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > Singleton
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 30 Topic 35510 of 36205
Post > Topic >>

Singleton

by Ugo <privacy@[EMAIL PROTECTED] > May 7, 2008 at 10:42 AM

Hi guys,

how do you make a singleton access class?

Do you know a better way of this one:

var singletonClass = (function( )
{
   // Private variable
   var instance = null;

   // Private Constructor
   function myClass( )
   {
      //...
   }

   return new function( )
   {
      this.constructor = null;

      this.getInstance = function( )
      {
         if( ! instance )
         {
            instance = new myClass( );
            instance.constructor = null;
         }

         return instance;
      }
   }
})( );
 




 30 Posts in Topic:
Singleton
Ugo <privacy@[EMAIL PR  2008-05-07 10:42:51 
Re: Singleton
Sam -- <noemail@[EMAIL  2008-05-07 14:39:24 
Re: Singleton
Ugo <privacy@[EMAIL PR  2008-05-07 18:14:25 
Re: Singleton
RoLo <rolosworld@[EMAI  2008-05-07 08:06:37 
Re: Singleton
RoLo <rolosworld@[EMAI  2008-05-07 08:08:10 
Re: Singleton
"Richard Cornford&qu  2008-05-21 22:20:21 
Re: Singleton
Ugo <privacy@[EMAIL PR  2008-05-23 16:22:42 
Re: Singleton
Thomas 'PointedEars' Lahn  2008-05-23 20:45:26 
Re: Singleton
"Richard Cornford&qu  2008-05-26 16:19:01 
Re: Singleton
Peter Michaux <petermi  2008-05-23 11:07:58 
Re: Singleton
Ugo <privacy@[EMAIL PR  2008-05-24 17:58:50 
Re: Singleton
"Richard Cornford&qu  2008-05-26 16:18:58 
Re: Singleton
"P. Prikryl" &l  2008-05-23 12:30:40 
Re: Singleton
Thomas 'PointedEars' Lahn  2008-05-23 21:54:35 
Re: Singleton
Peter Michaux <petermi  2008-05-23 12:43:47 
Re: Singleton
VK <schools_ring@[EMAI  2008-05-24 09:13:44 
Re: Singleton
Peter Michaux <petermi  2008-05-24 09:25:50 
Re: Singleton
Ugo <privacy@[EMAIL PR  2008-05-25 00:02:02 
Re: Singleton
VK <schools_ring@[EMAI  2008-05-24 13:31:52 
Re: Singleton
Peter Michaux <petermi  2008-05-24 16:19:51 
Re: Singleton
Ugo <privacy@[EMAIL PR  2008-05-25 09:01:38 
Re: Singleton
"Richard Cornford&qu  2008-05-26 16:19:05 
Re: Singleton
VK <schools_ring@[EMAI  2008-05-25 01:31:38 
Re: Singleton
Lasse Reichstein Nielsen   2008-05-25 13:42:07 
Re: Singleton
Lasse Reichstein Nielsen   2008-05-25 13:52:35 
Re: Singleton
VK <schools_ring@[EMAI  2008-05-25 05:07:35 
Re: Singleton
Lasse Reichstein Nielsen   2008-05-25 15:11:19 
Re: Singleton
VK <schools_ring@[EMAI  2008-05-25 08:35:40 
Re: Singleton
Peter Michaux <petermi  2008-05-25 10:18:55 
Re: Singleton
Peter Michaux <petermi  2008-05-21 21:14:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 7:22:27 CDT 2008.