JavaScript Namespace

后端 未结 11 1475
暗喜
暗喜 2020-12-15 07:25

I want to create a global namespace for my application and in that namespace I want other namespaces:

E.g.

Dashboard.Ajax.Post()

Dashboard.RetrieveC         


        
11条回答
  •  一整个雨季
    2020-12-15 07:55

    bob.js can help in defining your namespaces (among others):

    bob.ns.setNs('Dashboard.Ajax', {
    
        Post: function () { /*...*/ }
    });
    
    bob.ns.setNs('Dashboard.RetrieveContent', {
    
        RefreshSalespersonPerformanceContent: function () { /*...*/ }
    });
    

提交回复
热议问题