Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / output / Ext.Loader.js
1 Ext.data.JsonP.Ext_Loader({
2   "allMixins": [
3
4   ],
5   "deprecated": null,
6   "docauthor": "Jacky Nguyen <jacky@sencha.com>",
7   "members": {
8     "cfg": [
9       {
10         "type": "Boolean",
11         "deprecated": null,
12         "alias": null,
13         "protected": false,
14         "tagname": "cfg",
15         "href": "Loader.html#Ext-Loader-cfg-disableCaching",
16         "static": false,
17         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
18         "private": false,
19         "name": "disableCaching",
20         "owner": "Ext.Loader",
21         "doc": "<p>Appends current timestamp to script files to prevent caching Defaults to true</p>\n",
22         "linenr": 227,
23         "html_filename": "Loader.html"
24       },
25       {
26         "type": "String",
27         "deprecated": null,
28         "alias": null,
29         "protected": false,
30         "tagname": "cfg",
31         "href": "Loader.html#Ext-Loader-cfg-disableCachingParam",
32         "shortDoc": "The get parameter name for the cache buster's timestamp. ...",
33         "static": false,
34         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
35         "private": false,
36         "name": "disableCachingParam",
37         "owner": "Ext.Loader",
38         "doc": "<p>The get parameter name for the cache buster's timestamp. Defaults to '_dc'</p>\n",
39         "linenr": 233,
40         "html_filename": "Loader.html"
41       },
42       {
43         "type": "Boolean",
44         "deprecated": null,
45         "alias": null,
46         "protected": false,
47         "tagname": "cfg",
48         "href": "Loader.html#Ext-Loader-cfg-enabled",
49         "static": false,
50         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
51         "private": false,
52         "name": "enabled",
53         "owner": "Ext.Loader",
54         "doc": "<p>Whether or not to enable the dynamic dependency loading feature Defaults to false</p>\n",
55         "linenr": 221,
56         "html_filename": "Loader.html"
57       },
58       {
59         "type": "Object",
60         "deprecated": null,
61         "alias": null,
62         "protected": false,
63         "tagname": "cfg",
64         "href": "Loader.html#Ext-Loader-cfg-paths",
65         "shortDoc": "The mapping from namespaces to file paths\n\n{\n    'Ext': '.', // This is set by default, Ext.layout.container.Containe...",
66         "static": false,
67         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
68         "private": false,
69         "name": "paths",
70         "owner": "Ext.Loader",
71         "doc": "<p>The mapping from namespaces to file paths</p>\n\n<pre><code>{\n    'Ext': '.', // This is set by default, <a href=\"#/api/Ext.layout.container.Container\" rel=\"Ext.layout.container.Container\" class=\"docClass\">Ext.layout.container.Container</a> will be\n                // loaded from ./layout/Container.js\n\n    'My': './src/my_own_folder' // My.layout.Container will be loaded from\n                                // ./src/my_own_folder/layout/Container.js\n}\n</code></pre>\n\n<p>Note that all relative paths are relative to the current HTML document.\nIf not being specified, for example, <code>Other.awesome.Class</code>\nwill simply be loaded from <code>./Other/awesome/Class.js</code></p>\n",
72         "linenr": 239,
73         "html_filename": "Loader.html"
74       }
75     ],
76     "method": [
77       {
78         "deprecated": null,
79         "alias": null,
80         "protected": false,
81         "tagname": "method",
82         "href": "Loader.html#Ext-Loader-method-exclude",
83         "shortDoc": "Explicitly exclude files from being loaded. ...",
84         "static": false,
85         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
86         "private": false,
87         "params": [
88           {
89             "type": "String/[String]",
90             "optional": false,
91             "doc": "\n",
92             "name": "excludes"
93           }
94         ],
95         "name": "exclude",
96         "owner": "Ext.Loader",
97         "doc": "<p>Explicitly exclude files from being loaded. Useful when used in conjunction with a broad include expression.\nCan be chained with more <code>require</code> and <code>exclude</code> methods, e.g.:</p>\n\n<pre><code>Ext.exclude('Ext.data.*').require('*');\n\nExt.exclude('widget.button*').require('widget.*');\n</code></pre>\n\n<p><a href=\"#/api/Ext-method-exclude\" rel=\"Ext-method-exclude\" class=\"docClass\">Ext.exclude</a> is alias for <a href=\"#/api/Ext.Loader-method-exclude\" rel=\"Ext.Loader-method-exclude\" class=\"docClass\">Ext.Loader.exclude</a> for convenience.</p>\n",
98         "linenr": 584,
99         "return": {
100           "type": "Object",
101           "doc": "<p>object contains <code>require</code> method for chaining</p>\n"
102         },
103         "html_filename": "Loader.html"
104       },
105       {
106         "deprecated": null,
107         "alias": null,
108         "protected": false,
109         "tagname": "method",
110         "href": "Loader.html#Ext-Loader-method-getConfig",
111         "shortDoc": "Get the config value corresponding to the specified name. ...",
112         "static": false,
113         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
114         "private": false,
115         "params": [
116           {
117             "type": "String",
118             "optional": false,
119             "doc": "<p>The config property name</p>\n",
120             "name": "name"
121           }
122         ],
123         "name": "getConfig",
124         "owner": "Ext.Loader",
125         "doc": "<p>Get the config value corresponding to the specified name.\nIf no name is given, will return the config object.</p>\n",
126         "linenr": 298,
127         "return": {
128           "type": "Object/Mixed",
129           "doc": "\n"
130         },
131         "html_filename": "Loader.html"
132       },
133       {
134         "deprecated": null,
135         "alias": null,
136         "protected": false,
137         "tagname": "method",
138         "href": "Loader.html#Ext-Loader-method-getPath",
139         "shortDoc": "Translates a className to a file path by adding the the proper prefix and converting the .'s to /'s. ...",
140         "static": false,
141         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
142         "private": false,
143         "params": [
144           {
145             "type": "String",
146             "optional": false,
147             "doc": "\n",
148             "name": "className"
149           }
150         ],
151         "name": "getPath",
152         "owner": "Ext.Loader",
153         "doc": "<p>Translates a className to a file path by adding the the proper prefix and converting the .'s to /'s.\nFor example:</p>\n\n<pre><code>Ext.Loader.setPath('My', '/path/to/My');\n\nalert(Ext.Loader.getPath('My.awesome.Class')); // alerts '/path/to/My/awesome/Class.js'\n</code></pre>\n\n<p>Note that the deeper namespace levels, if explicitly set, are always resolved first. For example:</p>\n\n<pre><code>Ext.Loader.setPath({\n    'My': '/path/to/lib',\n    'My.awesome': '/other/path/for/awesome/stuff',\n    'My.awesome.more': '/more/awesome/path'\n});\n\nalert(Ext.Loader.getPath('My.awesome.Class')); // alerts '/other/path/for/awesome/stuff/Class.js'\n\nalert(Ext.Loader.getPath('My.awesome.more.Class')); // alerts '/more/awesome/path/Class.js'\n\nalert(Ext.Loader.getPath('My.cool.Class')); // alerts '/path/to/lib/cool/Class.js'\n\nalert(Ext.Loader.getPath('Unknown.strange.Stuff')); // alerts 'Unknown/strange/Stuff.js'\n</code></pre>\n",
154         "linenr": 335,
155         "return": {
156           "type": "String",
157           "doc": "<p>path</p>\n"
158         },
159         "html_filename": "Loader.html"
160       },
161       {
162         "deprecated": null,
163         "alias": null,
164         "protected": false,
165         "tagname": "method",
166         "href": "Loader.html#Ext-Loader-method-onReady",
167         "shortDoc": "Adds new listener to be executed when all required scripts are fully loaded. ...",
168         "static": false,
169         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
170         "private": false,
171         "params": [
172           {
173             "type": "Function",
174             "optional": false,
175             "doc": "<p>The function callback to be executed</p>\n",
176             "name": "fn"
177           },
178           {
179             "type": "Object",
180             "optional": false,
181             "doc": "<p>The execution scope (<code>this</code>) of the callback function</p>\n",
182             "name": "scope"
183           },
184           {
185             "type": "Boolean",
186             "optional": false,
187             "doc": "<p>Whether or not to wait for document dom ready as well</p>\n",
188             "name": "withDomReady"
189           },
190           {
191             "type": "Object",
192             "optional": false,
193             "doc": "\n",
194             "name": "options"
195           }
196         ],
197         "name": "onReady",
198         "owner": "Ext.Loader",
199         "doc": "<p>Adds new listener to be executed when all required scripts are fully loaded.</p>\n",
200         "linenr": 899,
201         "return": {
202           "type": "void",
203           "doc": "\n"
204         },
205         "html_filename": "Loader.html"
206       },
207       {
208         "deprecated": null,
209         "alias": null,
210         "protected": false,
211         "tagname": "method",
212         "href": "Loader.html#Ext-Loader-method-require",
213         "shortDoc": "Loads all classes by the given names and all their direct dependencies;\noptionally executes the given callback functi...",
214         "static": false,
215         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
216         "private": false,
217         "params": [
218           {
219             "type": "String/[String]",
220             "optional": false,
221             "doc": "<p>Can either be a string or an array of string</p>\n",
222             "name": "expressions"
223           },
224           {
225             "type": "Function",
226             "optional": false,
227             "doc": "<p>(Optional) The callback function</p>\n",
228             "name": "fn"
229           },
230           {
231             "type": "Object",
232             "optional": false,
233             "doc": "<p>(Optional) The execution scope (<code>this</code>) of the callback function</p>\n",
234             "name": "scope"
235           },
236           {
237             "type": "String/[String]",
238             "optional": false,
239             "doc": "<p>(Optional) Classes to be excluded, useful when being used with expressions</p>\n",
240             "name": "excludes"
241           }
242         ],
243         "name": "require",
244         "owner": "Ext.Loader",
245         "doc": "<p>Loads all classes by the given names and all their direct dependencies;\noptionally executes the given callback function when finishes, within the optional scope.</p>\n\n<p><a href=\"#/api/Ext-method-require\" rel=\"Ext-method-require\" class=\"docClass\">Ext.require</a> is alias for <a href=\"#/api/Ext.Loader-method-require\" rel=\"Ext.Loader-method-require\" class=\"docClass\">Ext.Loader.require</a> for convenience.</p>\n",
246         "linenr": 629,
247         "return": {
248           "type": "void",
249           "doc": "\n"
250         },
251         "html_filename": "Loader.html"
252       },
253       {
254         "deprecated": null,
255         "alias": null,
256         "protected": false,
257         "tagname": "method",
258         "href": "Loader.html#Ext-Loader-method-setConfig",
259         "shortDoc": "Set the configuration for the loader. ...",
260         "static": false,
261         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
262         "private": false,
263         "params": [
264           {
265             "type": "String/Object",
266             "optional": false,
267             "doc": "<p>Name of the value to override, or a config object to override multiple values.</p>\n",
268             "name": "name"
269           },
270           {
271             "type": "Object",
272             "optional": true,
273             "doc": "<p>(optional) The new value to set, needed if first parameter is String.</p>\n",
274             "name": "value"
275           }
276         ],
277         "name": "setConfig",
278         "owner": "Ext.Loader",
279         "doc": "<p>Set the configuration for the loader. This should be called right after ext-core.js\n(or ext-core-debug.js) is included in the page, e.g.:</p>\n\n<pre><code>&lt;script type=\"text/javascript\" src=\"ext-core-debug.js\"&gt;&lt;/script&gt;\n&lt;script type=\"text/javascript\"&gt;\n  Ext.Loader.setConfig({\n      enabled: true,\n      paths: {\n          'My': 'my_own_path'\n      }\n  });\n&lt;script&gt;\n&lt;script type=\"text/javascript\"&gt;\n  Ext.require(...);\n\n  Ext.onReady(function() {\n      // application code here\n  });\n&lt;/script&gt;\n</code></pre>\n\n<p>Refer to config options of <a href=\"#/api/Ext.Loader\" rel=\"Ext.Loader\" class=\"docClass\">Ext.Loader</a> for the list of possible properties.</p>\n",
280         "linenr": 260,
281         "return": {
282           "type": "Ext.Loader",
283           "doc": "<p>this</p>\n"
284         },
285         "html_filename": "Loader.html"
286       },
287       {
288         "deprecated": null,
289         "alias": null,
290         "protected": false,
291         "tagname": "method",
292         "href": "Loader.html#Ext-Loader-method-setPath",
293         "shortDoc": "Sets the path of a namespace. ...",
294         "static": false,
295         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
296         "private": false,
297         "params": [
298           {
299             "type": "String/Object",
300             "optional": false,
301             "doc": "<p>See <a href=\"#/api/Ext.Function-method-flexSetter\" rel=\"Ext.Function-method-flexSetter\" class=\"docClass\">flexSetter</a></p>\n",
302             "name": "name"
303           },
304           {
305             "type": "String",
306             "optional": false,
307             "doc": "<p>See <a href=\"#/api/Ext.Function-method-flexSetter\" rel=\"Ext.Function-method-flexSetter\" class=\"docClass\">flexSetter</a></p>\n",
308             "name": "path"
309           }
310         ],
311         "name": "setPath",
312         "owner": "Ext.Loader",
313         "doc": "<p>Sets the path of a namespace. For Example:</p>\n\n<pre><code>Ext.Loader.setPath('Ext', '.');\n</code></pre>\n",
314         "linenr": 312,
315         "return": {
316           "type": "Ext.Loader",
317           "doc": "<p>this</p>\n"
318         },
319         "html_filename": "Loader.html"
320       },
321       {
322         "deprecated": null,
323         "alias": null,
324         "protected": false,
325         "tagname": "method",
326         "href": "Loader.html#Ext-Loader-method-syncRequire",
327         "shortDoc": "Synchronously loads all classes by the given names and all their direct dependencies;\noptionally executes the given c...",
328         "static": false,
329         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
330         "private": false,
331         "params": [
332           {
333             "type": "String/[String]",
334             "optional": false,
335             "doc": "<p>Can either be a string or an array of string</p>\n",
336             "name": "expressions"
337           },
338           {
339             "type": "Function",
340             "optional": false,
341             "doc": "<p>(Optional) The callback function</p>\n",
342             "name": "fn"
343           },
344           {
345             "type": "Object",
346             "optional": false,
347             "doc": "<p>(Optional) The execution scope (<code>this</code>) of the callback function</p>\n",
348             "name": "scope"
349           },
350           {
351             "type": "String/[String]",
352             "optional": false,
353             "doc": "<p>(Optional) Classes to be excluded, useful when being used with expressions</p>\n",
354             "name": "excludes"
355           }
356         ],
357         "name": "syncRequire",
358         "owner": "Ext.Loader",
359         "doc": "<p>Synchronously loads all classes by the given names and all their direct dependencies;\noptionally executes the given callback function when finishes, within the optional scope.</p>\n\n<p><a href=\"#/api/Ext-method-syncRequire\" rel=\"Ext-method-syncRequire\" class=\"docClass\">Ext.syncRequire</a> is alias for <a href=\"#/api/Ext.Loader-method-syncRequire\" rel=\"Ext.Loader-method-syncRequire\" class=\"docClass\">Ext.Loader.syncRequire</a> for convenience.</p>\n",
360         "linenr": 611,
361         "return": {
362           "type": "void",
363           "doc": "\n"
364         },
365         "html_filename": "Loader.html"
366       }
367     ],
368     "property": [
369       {
370         "type": "[String]",
371         "deprecated": null,
372         "alias": null,
373         "protected": false,
374         "tagname": "property",
375         "href": "Loader.html#Ext-Loader-property-history",
376         "shortDoc": "An array of class names to keep track of the dependency loading order. ...",
377         "static": false,
378         "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
379         "private": false,
380         "name": "history",
381         "owner": "Ext.Loader",
382         "doc": "<p>An array of class names to keep track of the dependency loading order.\nThis is not guaranteed to be the same everytime due to the asynchronous nature of the Loader.</p>\n",
383         "linenr": 209,
384         "html_filename": "Loader.html"
385       }
386     ],
387     "cssVar": [
388
389     ],
390     "cssMixin": [
391
392     ],
393     "event": [
394
395     ]
396   },
397   "singleton": true,
398   "alias": null,
399   "superclasses": [
400
401   ],
402   "protected": false,
403   "tagname": "class",
404   "mixins": [
405
406   ],
407   "href": "Loader.html#Ext-Loader",
408   "subclasses": [
409
410   ],
411   "static": false,
412   "author": "Jacky Nguyen <jacky@sencha.com>",
413   "component": false,
414   "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
415   "private": false,
416   "alternateClassNames": [
417
418   ],
419   "name": "Ext.Loader",
420   "doc": "<p>Ext.Loader is the heart of the new dynamic dependency loading capability in <a href=\"#/api/Ext\" rel=\"Ext\" class=\"docClass\">Ext</a> JS 4+. It is most commonly used\nvia the <a href=\"#/api/Ext-method-require\" rel=\"Ext-method-require\" class=\"docClass\">Ext.require</a> shorthand. <a href=\"#/api/Ext.Loader\" rel=\"Ext.Loader\" class=\"docClass\">Ext.Loader</a> supports both asynchronous and synchronous loading\napproaches, and leverage their advantages for the best development flow. We'll discuss about the pros and cons\nof each approach:</p>\n\n<h1>Asynchronous Loading</h1>\n\n<ul>\n<li><p><em>Advantages:</em></p>\n\n<ul>\n<li> Cross-domain</li>\n<li> No web server needed: you can run the application via the file system protocol\n(i.e: <code>file://path/to/your/index.html</code>)</li>\n<li> Best possible debugging experience: error messages come with the exact file name and line number</li>\n</ul>\n</li>\n<li><p><em>Disadvantages:</em></p>\n\n<ul>\n<li> Dependencies need to be specified before-hand</li>\n</ul>\n</li>\n</ul>\n\n\n<h3>Method 1: Explicitly include what you need:</h3>\n\n<pre><code>// Syntax\nExt.require({String/Array} expressions);\n\n// Example: Single alias\nExt.require('widget.window');\n\n// Example: Single class name\nExt.require('Ext.window.Window');\n\n// Example: Multiple aliases / class names mix\nExt.require(['widget.window', 'layout.border', 'Ext.data.Connection']);\n\n// Wildcards\nExt.require(['widget.*', 'layout.*', 'Ext.data.*']);\n</code></pre>\n\n<h3>Method 2: Explicitly exclude what you don't need:</h3>\n\n<pre><code>// Syntax: Note that it must be in this chaining format.\nExt.exclude({String/Array} expressions)\n   .require({String/Array} expressions);\n\n// Include everything except Ext.data.*\nExt.exclude('Ext.data.*').require('*'); \n\n// Include all widgets except widget.checkbox*,\n// which will match widget.checkbox, widget.checkboxfield, widget.checkboxgroup, etc.\nExt.exclude('widget.checkbox*').require('widget.*');\n</code></pre>\n\n<h1>Synchronous Loading on Demand</h1>\n\n<ul>\n<li><p><em>Advantages:</em></p>\n\n<ul>\n<li> There's no need to specify dependencies before-hand, which is always the convenience of including\next-all.js before</li>\n</ul>\n</li>\n<li><p><em>Disadvantages:</em></p>\n\n<ul>\n<li> Not as good debugging experience since file name won't be shown (except in Firebug at the moment)</li>\n<li> Must be from the same domain due to XHR restriction</li>\n<li> Need a web server, same reason as above</li>\n</ul>\n</li>\n</ul>\n\n\n<p>There's one simple rule to follow: Instantiate everything with Ext.create instead of the <code>new</code> keyword</p>\n\n<pre><code>Ext.create('widget.window', { ... }); // Instead of new Ext.window.Window({...});\n\nExt.create('Ext.window.Window', {}); // Same as above, using full class name instead of alias\n\nExt.widget('window', {}); // Same as above, all you need is the traditional `xtype`\n</code></pre>\n\n<p>Behind the scene, <a href=\"#/api/Ext.ClassManager\" rel=\"Ext.ClassManager\" class=\"docClass\">Ext.ClassManager</a> will automatically check whether the given class name / alias has already\nexisted on the page. If it's not, <a href=\"#/api/Ext.Loader\" rel=\"Ext.Loader\" class=\"docClass\">Ext.Loader</a> will immediately switch itself to synchronous mode and automatic load\nthe given class and all its dependencies.</p>\n\n<h1>Hybrid Loading - The Best of Both Worlds</h1>\n\n<p>It has all the advantages combined from asynchronous and synchronous loading. The development flow is simple:</p>\n\n<h3>Step 1: Start writing your application using synchronous approach.</h3>\n\n<p>Ext.Loader will automatically fetch all dependencies on demand as they're needed during run-time. For example:</p>\n\n<pre><code>Ext.onReady(function(){\n    var window = Ext.createWidget('window', {\n        width: 500,\n        height: 300,\n        layout: {\n            type: 'border',\n            padding: 5\n        },\n        title: 'Hello Dialog',\n        items: [{\n            title: 'Navigation',\n            collapsible: true,\n            region: 'west',\n            width: 200,\n            html: 'Hello',\n            split: true\n        }, {\n            title: 'TabPanel',\n            region: 'center'\n        }]\n    });\n\n    window.show();\n})\n</code></pre>\n\n<h3>Step 2: Along the way, when you need better debugging ability, watch the console for warnings like these:</h3>\n\n<pre><code>[Ext.Loader] Synchronously loading 'Ext.window.Window'; consider adding Ext.require('Ext.window.Window') before your application's code ClassManager.js:432\n[Ext.Loader] Synchronously loading 'Ext.layout.container.Border'; consider adding Ext.require('Ext.layout.container.Border') before your application's code\n</code></pre>\n\n<p>Simply copy and paste the suggested code above <code>Ext.onReady</code>, e.g.:</p>\n\n<pre><code>Ext.require('Ext.window.Window');\nExt.require('Ext.layout.container.Border');\n\nExt.onReady(...);\n</code></pre>\n\n<p>Everything should now load via asynchronous mode.</p>\n\n<h1>Deployment</h1>\n\n<p>It's important to note that dynamic loading should only be used during development on your local machines.\nDuring production, all dependencies should be combined into one single JavaScript file. <a href=\"#/api/Ext.Loader\" rel=\"Ext.Loader\" class=\"docClass\">Ext.Loader</a> makes\nthe whole process of transitioning from / to between development / maintenance and production as easy as\npossible. Internally <a href=\"#/api/Ext.Loader-property-history\" rel=\"Ext.Loader-property-history\" class=\"docClass\">Ext.Loader.history</a> maintains the list of all dependencies\nyour application needs in the exact loading sequence. It's as simple as concatenating all files in this\narray into one, then include it on top of your application.</p>\n\n<p>This process will be automated with Sencha Command, to be released and documented towards <a href=\"#/api/Ext\" rel=\"Ext\" class=\"docClass\">Ext</a> JS 4 Final.</p>\n",
421   "mixedInto": [
422
423   ],
424   "linenr": 1,
425   "xtypes": [
426
427   ],
428   "html_filename": "Loader.html",
429   "extends": null
430 });