Backbone.js Initial

Source: Internet
Author: User

One, single page application

1, single page application (Single-page Application:spa), refers to the application running in the browser, the page will not be reloaded during use .

2, all of its activities are confined to a Web page, only the HTML, JavaScript, and CSS corresponding to the initialization load. Once the load is complete, theSpa will not reload the page or jump because of user action . It is the dynamic transformation of HTML content via JavaScript, avoiding page reloading and providing a more fluid user experience.

3.1, advantages: Before and after the separation, can be at the same time the development of the front and back; reduce server pressure; better user experience.

3.2, shortcomings: SEO problems, because there is only one page, search engine crawl data will only crawl the home page, the other jump interface will not be crawled;

Browsing history issues, there is no browser record, forward and backward need program management;

Initial load issue.

Ii. introduction of Backbone

1. BackBone is a lightweight MVC JavaScript library created by Jerry Ashkenas, with two features:

Forced dependency Underscore.js

Non-mandatory dependent on jquery/zepto

2. The following is the architecture diagram:

When the user enters the address that we want to access in the browser,router will listen to the URL of the hash value change, and then match to the corresponding view interface, this time the view will be sued Model or the Collection, indicating that they need data to Xuan our page, and then model and Collection go to the corresponding data request . After you get the data, return to view and render the page.

  

  

A brief introduction to several frameworks

1. MVC Framework Model-view-controller

· View UserInterface: Transfer instruction to Controller

· Controller Businesslogic: After the controller has completed the business logic, the model is required to change state

· Model DataPreservation: Send new data to view, users get feedback

      

2. MVP Framework Model-view-presenter

· The communication between the parts is bidirectional

· View and model do not have direct contact, mainly through the presenter transmission

· View is very thin and does not deploy any business logic

· Presenter is very thick and deploys all the business logic

      

3. MVVM Frame: Model-view-viewmodel

· The MVVM pattern renamed presenter to ViewModel, which is basically exactly the same as the MVP model

· The difference is that the change in the two-way binding mode (data binding) View is automatically reflected on the ViewModel and vice versa.

· For example, the data in the view changes, do not need to notify Viewmodel,viewmodel oneself will get change, similarly, model changes, ViewModel do not need to notify View,view himself will know.

      

 

Backbone.js initial

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.