jquery 单体模式实例化--创建实例后调用

2011-08-09 16:09:47 by 【6yang】, 169 visits, 收藏 | 返回

//test singleton instance 单体模式实例化;

 
    //test singleton instance
    function Test(){
        this.a = 5;
    }
    $.extend(Test.prototype, {
        error:function(){
            return this.a;
        }
    });
    $.obj = new Test();
    alert($.obj['error'].apply($.obj, []));
    //alert($.obj.error());

分享到:
share

    图片原图

    loading

    loading