javascript code architecture question

前端 未结 2 1617
慢半拍i
慢半拍i 2021-02-11 09:04

I\'m about to make a web app which will have a pretty heavy client end. I\'m not sure about the way to organize my javascript code, but here is a basic idea :

//         


        
2条回答
  •  庸人自扰
    2021-02-11 10:01

    When you build something non trivial, encapsulation is important to make things maintainable in long run. For example, JS UI is not just simple JS methods. A UI components consists of css, template, logic, localization, assets(images, etc).

    It is same for a product module, it may need its own settings, event bus, routing. It is important to do some basic architectural code in integrating your chosen set of libraries. This had been a challenge for me when I started large scale JS development. I compiled some best practices in to a reference architecture at http://boilerplatejs.org for someone to use the experience I gained.

提交回复
热议问题