The requires of ExtJS4 is a new mechanism mainly to implement asynchronous loading. The following articles will introduce the use of requires in ExtJS4, do not miss the requires of ExtJS4. It is a new mechanism, mainly to implement asynchronous loading. In this way, the corresponding js file will not be loaded without clicking the corresponding button or option, improving the loading speed and user waiting time.
The implementation of the requires mechanism uses an Ext. Loader. setConfig function to set the ing directory for file searching, and then uses Ext. require for loading when the corresponding js file is needed.
The file storage structure is as follows:
Uxfolder and lesson2.htm and lesson22.js are in the same directory, and MyWin. js used is stored in the ux folder.
The code in lesson2.html is as follows:
The Code is as follows: