If I understood it correctly you are looking to see which all libraries( or packages) are there in the final build. In case you are using webpack try webpack-bundle-analyzer . In case you are using browserify Disc can help you.
@panghal0
JS learner
Nothing here yet.
Nothing here yet.
No blogs yet.
If I understood it correctly you are looking to see which all libraries( or packages) are there in the final build. In case you are using webpack try webpack-bundle-analyzer . In case you are using browserify Disc can help you.
Singletons are the one's that can be initialized only once. In the simplest possible terms here is a singleton for you. var singleton = { key: "value" }; Another way var Singleton = ( function ( ) { var instance; var SingletonClass = function ( ) { this .someProp = "someValue" ; // all other stuff you want on your singleton instance; }; return { getInstance: function ( ) { if (!instance){ instance = new SingletonClass(); } return instance; } } })(); var aSingleton = Singleton.getInstance(); var bSingleton = Singleton.getInstance(); console .log(aSingleton.someProp); //someValue console .log(bSingleton.someProp); //someValue aSingleton.someProp = "someOtherValue" ; console .log(a.someProp); //someOtherValue console .log(b.someProp); //someOtherValue In case you want to use new keyword for initialization var Singleton = ( function ( ) { var instance; function SingletonClass ( ) { this .someProp = "someValue" ; // all other stuff you want on your singleton instance; if (instance) { return instance; } instance = this ; } return SingletonClass; }()); var aSingleton = new Singleton(); var bSingleton = new Singleton(); console .log(aSingleton.someProp); //someValue console .log(bSingleton.someProp); //someValue aSingleton.someProp = "someOtherValue" ; console .log(aSingleton.someProp); //someOtherValue console .log(bSingleton.someProp); //someOtherValue Hope it helps.