In the previous article on javascript dynamic loading, it was mentioned that the use of synchronous loading strategy is used to implement such as
Using("jquery");
Using("User");
$("#ID").click(function(){
var user = new User();
user.name = "xx";
user.show();
});
Since JS is single-threaded, so The synchronization strategy brings many disadvantages, such as preventing subsequent code from running and causing the browser to freeze.
It is difficult to achieve the effect of using the leading package later using the asynchronous strategy. It can only be done in the form of callback, which is not what UsingJS wants to achieve. After all, jQuery's getScript function can achieve this method.
After some thinking, I finally came up with a solution on how to solve the problem of booting packets in an asynchronous manner. Let’s first look at the programming method after adopting this solution.
< /div>
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31