Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (39 sloc) 3.123 kb
fcc4fff @phiggins42 monster commit from moinconverter, which is always done prior to the …
phiggins42 authored
1 .. _loader/index:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
2
149841c @phiggins42 mostly dojox.widget cleanups
phiggins42 authored
3 ===============
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
4 The Dojo Loader
5 ===============
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
6
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
7 :Author: Rawld Gill
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
8
9
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
10 Since program complexity tends to increase geometrically as program size increases linearly, the only hope of success when
11 implementing a large program is to break it into several small programs. From the beginning, the Dojo Toolkit was
12 designed for use when building large programs which is why Dojo was among the first libraries to include a formal module
13 system.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
14
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
15 The idea of a module system is fairly straight-forward:
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
16
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
17 * define an API to use when defining modules
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
18
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
19 * construct a loader that implements the API so that modules can be assembled into a complete program at run-time
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
20
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
21 With these two blocks in place, large JavaScript programs can be divided into many--perhaps hundreds--of small modules,
22 thereby greatly simplifying program construction. Indeed, the Dojo Toolkit itself is expressed in terms of many smallish
23 JavaScript resources.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
24
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
25 Since each individual resource implies an HTTP transaction to download that resource, bandwidth and latency constraints
26 can result in sluggish loading performance. Fortunately, this problem is easy to fix. Once the program is constructed,
27 the modules can be analyzed by a program and aggregated so that only few resources are actually downloaded, with each of
4c91b21 @wkeese loader/ spelling
wkeese authored
28 those resources containing several logical modules. Typically, this step occurs when moving from development to
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
29 deployment.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
30
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
31 Dojo was among the first JavaScript libraries to define a module API and publish a loader and build application to solve
32 all of these problems. The original API included the functions ``dojo.require`` (request a module), ``dojo.provide``
33 (define a module), and other supporting functions. This API is now termed the "legacy API".
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
34
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
35 Since early 2010, there has been a renewed interest in improving JavaScript modules systems. A single API has
36 emerged: `the Asynchronous Module Definition (AMD) API <https://github.com/amdjs/amdjs-api/wiki/AMD>`_ ("AMD API"). This
4c91b21 @wkeese loader/ spelling
wkeese authored
37 API has seen dramatic uptake over 2011 and has become the de facto standard for constructing client-side
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
38 JavaScript modules. While keeping the promise of backward compatibility for the 1.x product line, Dojo fully supports
39 this standard as of v1.7.0. (Note: Dojo will drop support for the legacy API in version 2.0).
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
40
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
41 In version 1.7.0, the Dojo loader and build system have been completely rewritten to support **both** the AMD API and
42 full legacy backward compatibility. Several new supporting APIs have also been constructed, including the AMD plugin,
43 has.js, dojo configuration, dojo loader micro-events, error reporting, and tracing APIs. Lastly, most of the dojo and
b8b1a08 fixing some kind of breakage
Website Account authored
44 dijit trees as well as large parts of the dojox tree have been converted to use the AMD API.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
45
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
46 The tutorials and reference manuals listed below describe all of this machinery.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
47
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
48 :ref:`The Dojo AMD Loader <loader/amd>`
49 Describes the Dojo AMD loader.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
50
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
51 :ref:`The Dojo Legacy Module System <loader/legacy>`
52 Describes how the Dojo AMD loader works with legacy modules.
d608cc5 @phiggins42 \r\n -> \n conversion.
phiggins42 authored
53
9dd52dc @phiggins42 mondo whitespace change
phiggins42 authored
54 :ref:`The Dojo Build System <build/index>`
55 The top page for the build system documentation.
Something went wrong with that request. Please try again.