Quickly build a SPA Framework salutjs--project Catalog One

Source: Internet
Author: User

Cause

Just entered the company, then, is an app app, Spa is built by the predecessors, the use of the technology is mainly backbone and zepto. Then the man went away and boiled a man and took the item. The more you get to the back of the project, the more you find the drawbacks, and the constant increase in the interface and business makes the whole application look bloated. So I thought it was time to refactor. At that time also coincidentally is just know Requirejs, think interface, always can like that module, asynchronous load come in. So in the old bottle filled with new wine, in addition to the interface, the code structure is completely rewritten. Later secretly took another person's work, is also app application, feel like we before, also put the reconstructed code together, found the effect is very good. After the completion of the gradual birth of their own framework of the idea, and then pull out the code, modify, optimization. Build up a fast-developing code base based on backbone. A single-interface app for developing HTML.

Brief introduction

Now name it Salutjs. Its role is primarily to allow developers to focus on specific business, quickly build the infrastructure. If you use Salut, you can build a simple single page application in two minutes. Of course, the so-called single page refers to the situation without refreshing the interface to switch the view interface, is the user feel that the entire application interface is the process, no refresh. We are using the browser's hash change value and div hidden switch to achieve this function. By detecting the change of the hash value of the browser, the display and hiding of the DIV (a complete interface) can be changed to achieve the effect of no-refresh switch interface. At first there is a question, that is, if the interface more and more, will not affect the load performance? I think this is the question that every mobile development person goes back to think about. Salutjs has solved this problem for you. The interface can be split, combined, and asynchronously loaded. You can load the other interface asynchronously at the start of the first interface, and then when needed. The resource file (js,template) is loaded asynchronously to the client. This solves the problem of business prompting which causes the first screen to load slowly. Second, all of Salutjs's programs are almost only a few lines of configuration to show, is to configure the interface development, you need to do to build business requirements and interface CSS code writing. With its simple API, you can quickly profile the various interfaces in tandem.

Example

The Salutjs will be introduced in the next few blog posts in succession. Demonstrate its specific use by making a simple single-page application. The following is the instance part. Can change the address bar to change the hash value to promote the interface changes.

Conclusion

Salutjs only for the quick development of the spa for this simple purpose. Of course, the mistakes and the lack of consideration are unavoidable. You can fork on GitHub, find the problem by reading the code, and I present your valuable advice and refine it together to benefit the vast majority of programmers. In addition, although now use is Requirejs, but the module that the asynchronous module is loaded has already rewritten once, the use of although passable, compared to Requirejs, does not have its maturity, but the volume is only one-fourth of it, in order to streamline the code, the stew will replace it later. Also, stewed to the last is also want to replace the backbone, really realize their own set of native framework. The project is larger and takes a lot of time. You also need your generous help.

Source Address

Https://github.com/constantince/Salut

Quickly build a SPA Framework salutjs--project Catalog One

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.