码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript学习笔记

时间:2014-10-10 18:55:34      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   java   sp   div   art   

单例模式的实现:

//单例对象
var Universe;

(function () {

   //单例缓存
    var instance;

    Universe = function Universe() {

        if (instance) {
            return instance;
        }

        instance = this;

        // 其它内容
        this.start_time = 0;
        this.bang = "Big";
    };
} ());

 

JavaScript学习笔记

标签:style   blog   color   io   ar   java   sp   div   art   

原文地址:http://www.cnblogs.com/qzyuanmu/p/4016116.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!