source: Dev/branches/rest-dojo-ui/client/util/buildscripts/jslib/dojoGuardStart.jsfrag @ 273

Last change on this file since 273 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.4 KB
Line 
1;(function(){
2
3        /*
4        dojo, dijit, and dojox must always be the first three, and in that order.
5        djConfig.scopeMap = [
6                ["dojo", "fojo"],
7                ["dijit", "fijit"],
8                ["dojox", "fojox"]
9       
10        ]
11        */
12
13        /**Build will replace this comment with a scoped djConfig **/
14
15        //The null below can be relaced by a build-time value used instead of djConfig.scopeMap.
16        var sMap = null;
17
18        //See if new scopes need to be defined.
19        if((sMap || (typeof djConfig != "undefined" && djConfig.scopeMap)) && (typeof window != "undefined")){
20                var scopeDef = "", scopePrefix = "", scopeSuffix = "", scopeMap = {}, scopeMapRev = {};
21                sMap = sMap || djConfig.scopeMap;
22                for(var i = 0; i < sMap.length; i++){
23                        //Make local variables, then global variables that use the locals.
24                        var newScope = sMap[i];
25                        scopeDef += "var " + newScope[0] + " = {}; " + newScope[1] + " = " + newScope[0] + ";" + newScope[1] + "._scopeName = '" + newScope[1] + "';";
26                        scopePrefix += (i == 0 ? "" : ",") + newScope[0];
27                        scopeSuffix += (i == 0 ? "" : ",") + newScope[1];
28                        scopeMap[newScope[0]] = newScope[1];
29                        scopeMapRev[newScope[1]] = newScope[0];
30                }
31
32                eval(scopeDef + "dojo._scopeArgs = [" + scopeSuffix + "];");
33
34                dojo._scopePrefixArgs = scopePrefix;
35                dojo._scopePrefix = "(function(" + scopePrefix + "){";
36                dojo._scopeSuffix = "})(" + scopeSuffix + ")";
37                dojo._scopeMap = scopeMap;
38                dojo._scopeMapRev = scopeMapRev;
39        }
Note: See TracBrowser for help on using the repository browser.