标签:style blog java color io cti
var SingleTon = (function(){ var initinstance; function myConstructor(){ return{ publicMethod : function(){ alert(this.value); }, value : ‘haha‘ } } return{ getInstance : function(){ if(!initinstance){ initinstance = myConstructor(); } return initinstance; } } })() SingleTon.getInstance().publicMethod();
javascript实现单例模式,布布扣,bubuko.com
标签:style blog java color io cti
原文地址:http://www.cnblogs.com/teamobaby/p/3858325.html