尼莫叮

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

2013年3月6日

摘要: 单例模式:// 使用对象字面量定义var Singleton = { attribute1: true, attribute2: 10; method1: function () { ... } method2: function() { ... }}// 使用方法Singleton.attribute1 = false;var result = Singleton.method1()// 因为javaScript中没有命名空间的概念,因此单例模式很大的一个用途就是定义命名空间.MyNameSpace中的findProdu... 阅读全文
posted @ 2013-03-06 15:51 尼莫叮 阅读(147) 评论(0) 推荐(0)