JavaScript设计模式之模块模式

之前同事这么用的。

进行了代码封装,看着代码比较整洁

var client = {};
(function (self) {
    if (!self) {
        window.client = {};
        self = window.client;
    }
    self.clientA = {};
    self.clientA.fun1 = function () {

    };
    self.clientA.fun2 = function () {

    };

    self.clientB = {};
    self.clientB.func1 = function () {
        
    };
    self.clientB.func2 = function () {

    };

    self.clientC = {};
})(client);

猜你喜欢

转载自blog.csdn.net/liubangbo/article/details/83716581
今日推荐