Banquet 47

  • Published on
    31-May-2015

  • View
    490

  • Download
    7

Embed Size (px)

Transcript

  • 1. 2010.11.08

2. 927 360, QQ928 3601014 3601028 3601029 360 QQ 113 360QQ360360 Web QQWeb QQ114 3606QQ115 360 3. 4. 5. 6. 7. 8. http://gs.statcounter.com/ 9. public class Singleton {private static Singleton uniqueInstance = null; //private Singleton(){ } //public static Singleton getInstance() {if (uniqueInstance == null){ uniqueInstance = new Singleton ();}return uniqueInstance}}Singleton. getInstance(); // 10. JavaScript// var Singleton = { attribute1: true, attribute2: 12, method1: function(){ }, method1: function(){ }} 11. Ext = { }; ////Ext.util = { };Ext.lib = { };Ext.util.JSON = { }Ext.util.Observable = { };Ext.util.TaskRunner = { }; 12. Namespace.pageName = {// page contants.CONSTANT_1: true,CONSTANT_2: true,// page methods.method1: function(){ },method2: function(){ },// Initializtion method.init: function(){ }}addLoadEvent(Namespace.pageName.init); 13. GiantCorp.DataParser = {// Private methods._stripWhitespace: function (str){return str.replace(/s+/, );},_stringSplit: function (str, delimiter){return str.split(delimiter);}// Public method.stringToArray: function(str, delimiter, stripWS){ }} 14. MyNameSpace.Singleton = (function(){ // Private members. var privateAttribute1 = false; function privateMethod1(){ } return {// Public members.publicAttribute1: 10,publicMethod1: function(){} }})(); 15. MyNameSpace.Singleton = (function(){ return { getInstance: function(){ var uniqueInstance;if(!uniqueInstance){ uniqueInstance = constructor(); function constructor(){} // Private members.return uniqueInstance; var privateAttribute1 = false;} function privateMethod1(){} }})(); return { // Public members. atttibute1: 10, method1: function(){ } } }MyNameSpace.Singleton.getInstance().method1(); 16. Thanks!