Using ExtJS development MIS system (2): JS dynamic loading

Source: Internet
Author: User

For a complex system, the client's JS may have hundreds, if all loaded into the user's browser, on the one hand will lead to redundant network transmission, on the other hand, the browser resolution of a large number of JS will lead to performance degradation, these two points will significantly affect the user can detect performance. So for JS loading, is dynamic, this dynamic performance in two ways:

Can not load the JS will never load.

The JS that needs to be loaded is not loaded until it is actually used.

1, can not load the JS will never load

Take the process of landing as an example:

An attempt to log in involves two scenarios, one when the user refreshes the page try to automatically log on according to the current token, the other is the user in the last login to save the user name and password, both of which are successful landing, do not need users to land again, and thus do not need to load formlogin this JS.

2, need to load the JS in until it is actually used to load

For a functional module, a display-related menu item is generated only if the current user has permissions for the module. Now when a menu item for the module is clicked for the first time, the associated JS of the module is loaded:

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.