U
Ugo
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;
}
}
})( );
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;
}
}
})( );