摘要:控制共享实例
var LazySingle = (function(){
var _instance = null
var Single = function () {
return {
publicMethod: function (){},
publicProperty: 'test'
}
}
return function () {
if (!_instance) {
_instance = new Single()
}
return _instance
}
})()
console.log(LazySingle().publicProperty)