$("#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.