]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/_base/_loader/loader_debug.js
2 Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo
._hasResource
["dojo._base._loader.loader_debug"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
9 dojo
._hasResource
["dojo._base._loader.loader_debug"] = true;
10 dojo
.provide("dojo._base._loader.loader_debug");
12 //Override dojo.provide, so we can trigger the next
13 //script tag for the next local module. We can only add one
14 //at a time because there are browsers that execute script tags
15 //in the order that the code is received, and not in the DOM order.
16 dojo
.nonDebugProvide
= dojo
.provide
;
18 dojo
.provide = function(resourceName
){
19 var dbgQueue
= dojo
["_xdDebugQueue"];
20 if(dbgQueue
&& dbgQueue
.length
> 0 && resourceName
== dbgQueue
["currentResourceName"]){
21 //Set a timeout so the module can be executed into existence. Normally the
22 //dojo.provide call in a module is the first line. Don't want to risk attaching
23 //another script tag until the current one finishes executing.
25 window
.setTimeout(function(){dojo
._xdDebugFileLoaded(resourceName
);}, 1);
27 window
.setTimeout(dojo
._scopeName
+ "._xdDebugFileLoaded('" + resourceName
+ "')", 1);
31 return dojo
.nonDebugProvide
.apply(dojo
, arguments
);
34 dojo
._xdDebugFileLoaded = function(resourceName
){
36 if(!dojo
._xdDebugScopeChecked
){
37 //If using a scoped dojo, we need to expose dojo as a real global
38 //for the debugAtAllCosts stuff to work.
39 if(dojo
._scopeName
!= "dojo"){
40 window
.dojo
= window
[dojo
.config
.scopeMap
[0][1]];
41 window
.dijit
= window
[dojo
.config
.scopeMap
[1][1]];
42 window
.dojox
= window
[dojo
.config
.scopeMap
[2][1]];
45 dojo
._xdDebugScopeChecked
= true;
48 var dbgQueue
= dojo
._xdDebugQueue
;
50 if(resourceName
&& resourceName
== dbgQueue
.currentResourceName
){
54 if(dbgQueue
.length
== 0){
55 //Check for more modules that need debug loading.
56 //dojo._xdWatchInFlight will add more things to the debug
57 //queue if they just recently loaded but it was not detected
58 //between the dojo._xdWatchInFlight intervals.
59 dojo
._xdWatchInFlight();
62 if(dbgQueue
.length
== 0){
63 dbgQueue
.currentResourceName
= null;
65 //Make sure nothing else is in flight.
66 //If something is still in flight, then it still
67 //needs to be added to debug queue after it loads.
68 for(var param
in dojo
._xdInFlight
){
69 if(dojo
._xdInFlight
[param
] === true){
74 dojo
._xdNotifyLoaded();
76 if(resourceName
== dbgQueue
.currentResourceName
){
77 dbgQueue
.currentResourceName
= dbgQueue
[0].resourceName
;
78 var element
= document
.createElement("script");
79 element
.type
= "text/javascript";
80 element
.src
= dbgQueue
[0].resourcePath
;
81 document
.getElementsByTagName("head")[0].appendChild(element
);