Home > Article > Web Front-end > JavaScript basic system based on jQuery architecture_jquery
The use of jQuery has begun to become the main product of choice for JavaScript developers. However, without an overall plan, simple adoption will inevitably lead to an increase in later maintenance costs. A large number of jQuery plug-ins are like a double-edged sword. On the one hand, they save a lot of money. It reduces the development time and cycle, but it also causes the burden of WEB page loading, which will cause difficulty in maintenance and secondary expansion costs. Therefore, before using it, you need a most basic JavaScript architecture system that can clearly understand the basic functional components. , plug-in components are effectively implemented and extended.
We think that after all, jQuery is just a basic and lowest-level toolset, encapsulating element selectors, events, etc., which can basically meet general needs, but it must be viewed from the perspective of the overall WEB , in order to improve the efficiency and reusability of JavaScript development, an overall layout is needed. Biuuu believes that the simplest idea is as follows:
1. Encapsulate a layer of operations on top of the existing ajax interface. It is mainly used to unify the ajax entrance. At the same time, it can be subdivided to separate GET and POST. Through the global entrance, you can check the organization, such as filtering parameters, checking parameters, adding global parameters, etc., in one step, you can The reusability is very high, the implementation is as follows: