Easyloader [easyui_1.4.2] Analysis of the source code, hands even

Source: Internet
Author: User

With Easyui for a long time, but seldom to see the source. There is no solution to the problem of Baidu ...

Today found that the source of Easyui is not difficult to understand. And the combination of Easyloader can be very convenient to study the components of Easyui.

However, Easyloader's official API presentation is very brief.

Easyloader.base = '. /‘; Set Easyui base directory  easyloader.load (' Messager ', function () {//Load specified module      

Above

(1) Easyloader.base, which directory should be pointed to?

(2) easyloader.load (' Messager ', ... Don't need to introduce CSS files in advance?

These issues are not described in the API. No way, only to see the source.

After reading the source code, you can know:

(1) Easyloader.base, should point to a root directory, this root directory must be contains plugins, themes, locale, is actually downloaded from the official website Easyui a version of the root directory after the decompression. (explicitly set in the source code, loading CSS from the themes directory to get, loading JS from the plugins directory to get ...)

(2) easyloader.load (' Messager ', function () {}); You can also write a using (' Messager ', function () {}). This is written using the LoadModule () method to load the file. The module's JS and CSS will be loaded, as well as JS and CSS depending on the module.

Easyloader source code is relatively simple. Analysis of the source code, I use the wonderful taste of classroom Dupeng teacher Analysis of jquery method. Analysis of the following, relatively humble, the reason is not difficult, there is nothing to write.

* Easyloader [easyui_1.4.2]|-source {426} line. (function () {modules: {}//(199) locales: {}//(201, 224) Queues:loadjs ()://(2 244) Runjs ()://() Loadcss ()://loadsingle ()://(267, 307) LoadModule ()://(309, 371) Easyloader: {//(373, 403) modules: locales:base:theme:css:locale:timeout:load:onprogress:onload:}window.using = Easyloader.load; (415,)}) ();

  

Write a small example.

jquery-easyui-1.4.2

|-Locale

|-my

|-Demo1

|-test.html

|-Plugins

|-Themes

...

Test.html

<! DOCTYPE html>

jquery and Easyloader itself must be introduced. Other JS and CSS will not be introduced.

Easyloader is only loaded with Easyui volume sound customization. It can be used for research. Universal loading or learning to use require.js and sea.js

Easyloader [easyui_1.4.2] Analysis of the source code, hands even

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.