0 votes
39 views
asked in java script by (3.1k points)
hi friends.

   is there any way to create sigleton class in javascript?

1 Answer

0 votes
answered by

 

 

 

I think the easiest way is to declare a simple object literal:

function InEvents()

{

    this.ChangeListener=null;      

    this.setChangeListener=function(listener)    {

       //do something

    }  

}

var Events=new InEvents();

 

for more information just refer the below link

http://stackoverflow.com/questions/1635800/javascript-best-singleton-pattern?lq=1

Categories

...