Otherwise known as the module design pattern this pattern allows you to create private JS Variables or methods through the clever use of closures. The singleton is a good pattern to use when you you have a class of static methods, or you have a class that will only be used once. A good candidate for a singleton is the entry point into your application.
MyApp = function(){
var data; data is private and can't be accessed from outside.
return {
init: function(){
// Initialize application here
},
getData: function(){
return data;
}
};
}();
Ext.onReady(MyApp.init, MyApp);