What can JS actually achieve?

Source: Internet
Author: User

What can JS actually achieve?

1. Css+js, can achieve a lot of dazzling effects, such as rotation, amplification, deformation, etc. these words, in fact, the general front-end development in contact with the CSS3 very NB properties, can be easily realized

2. Front-end performance optimization, this block actually involves a lot of things, for non-JS, it is not too much to say, the main next and JS related. We know that JS loaded into the page is mainly divided into 2 steps, one is to download, the second is to parse; if JS synchronous download, in fact, will block the download of other resources, this is why the JS asynchronous out of the reason, then this has a problem, then I put JS asynchronous processing, why not put it in the head? Isn't the asynchronous resource not blocking the download of other resources? Here also involves a problem, that is, JS parsing problem, JS download after the completion will be parsed, parsing will block the download of other resources, the more important one problem is to parse the JS process if there is the operation of the DOM, the page is not downloaded, will error. So now the site is generally put JS at the bottom of the page. Is that the best way to put it at the bottom? No, JS does not implement on-demand loading. How to understand on-demand loading, is to follow the page needs to show the content to load the corresponding place to use JS. Simply put, it is in the page initialization, I only load and the first screen related JS, the other JS is not loaded. This way when the page opens, only a few JS files will be loaded, the site speed can be greatly improved. That is how to achieve the JS load on demand, that is: a JS modular/low-coupling organization, the second is to implement on-demand loading through the tool, we use the Requirejs for the modular loading. In addition to JS on-demand loading, in fact, there is a large impact on the performance of the problem, is the logic of JS itself, this block on performance is also very large, especially for some JS engine weak browser, the impact of greater. This piece involves a lot of things, simply for example, the page has 300 Li, through the jquery $ ("Li") way to find, you can forget the time needed to find, if your results are not saved, each time is used $ (' Li ') to find, and I stored once, After the direct use of the saved, compared to the running time. You will find that the running time gap is very large.

3. Front-end template engine, including Underscorejs or Arttemplatejs, although these are just a few tools, but reasonable use, to improve the efficiency is still very obvious; and then we'll explain this part further separately

4. Backbonejs, combined with our current development of the project, backbone is very practical, mainly in front of the background separation, and for the front-end structure of the construction and efficiency of the improvement, there is a great leap. Next, we will explain in detail the application of backbone in front-end development.

5. Requirejs, this is a front-end development of the tool bar, its main role is to manage JS, and modular and asynchronous JS, for the management of file loading, has a great help. This section will also be explained in chapters.

6. There is also a current development as a front-end, basically have to understand, is nodejs, this thing has a lot of effect, not to elaborate. Today the main explanation under the use of Nodejs developed a semi-automated testing role-PHANTOMJS, the current test of our side of the topic is basically the test tool, but is based on the PHANTOMJS to develop two times. This section will also be explained in chapters.

7. Grunt, this is currently not fully used in our specific projects, but many of its functions are worthy of research and promotion.

What can JS actually achieve?

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.