source: Dev/branches/rest-dojo-ui/client/dojo/_base/config.js @ 256

Last change on this file since 256 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: 8.1 KB
Line 
1define(["../has", "require"], function(has, require){
2        // module:
3        //              dojo/_base/config
4        // summary:
5        //              This module defines the user configuration during bootstrap.
6        // description:
7        //              By defining user configuration as a module value, an entire configuration can be specified in a build,
8    //          thereby eliminating the need for sniffing and or explicitly setting in the global variable dojoConfig.
9    //          Also, when multiple instances of dojo exist in a single application, each will necessarily be located
10        //              at an unique absolute module identifier as given by the package configuration. Implementing configuration
11        //              as a module allows for specifying unique, per-instance configurations.
12        // example:
13        //              Create a second instance of dojo with a different, instance-uniqe configuration (assume the loader and
14        //              dojo.js are already loaded).
15        //              |       // specify a configuration that creates a new instance of dojo at the absolute module identifier "myDojo"
16        //              |       require({
17        //              |               packages:[{
18        //              |                       name:"myDojo",
19        //              |                       location:".", //assume baseUrl points to dojo.js
20        //              |           }]
21        //              |       });
22        //              |
23        //              |       // specify a configuration for the myDojo instance
24        //              |       define("myDojo/config", {
25        //              |               // normal configuration variables go here, e.g.,
26        //              |               locale:"fr-ca"
27        //              |       });
28        //              |
29        //              |       // load and use the new instance of dojo
30        //              |       require(["myDojo"], function(dojo) {
31        //              |               // dojo is the new instance of dojo
32        //              |               // use as required
33        //              |       });
34
35        var result = {};
36        if(has("dojo-config-api")){
37                // must be the dojo loader; take a shallow copy of require.rawConfig
38                var src = require.rawConfig, p;
39                for(p in src){
40                        result[p] = src[p];
41                }
42        }else{
43                var adviseHas = function(featureSet, prefix, booting){
44                        for(p in featureSet){
45                                p!="has" && has.add(prefix + p, featureSet[p], 0, booting);
46                        }
47                };
48                result = has("dojo-loader") ?
49                        // must be a built version of the dojo loader; all config stuffed in require.rawConfig
50                        require.rawConfig :
51                        // a foreign loader
52                        this.dojoConfig || this.djConfig || {};
53                adviseHas(result, "config", 1);
54                adviseHas(result.has, "", 1);
55        }
56        return result;
57
58/*=====
59// note:
60//              'dojoConfig' does not exist under 'dojo.*' so that it can be set before the
61//              'dojo' variable exists.
62// note:
63//              Setting any of these variables *after* the library has loaded does
64//              nothing at all.
65
66// FIXME: can we document these on dojo.config object and explain they must be set via djConfig/dojoConfig global prior to loading dojo.js
67
68dojoConfig = {
69        // summary:
70        //              Application code can set the global 'dojoConfig' prior to loading
71        //              the library to control certain global settings for how dojo works.
72        //
73        // isDebug: Boolean
74        //              Defaults to `false`. If set to `true`, ensures that Dojo provides
75        //              extended debugging feedback via Firebug. If Firebug is not available
76        //              on your platform, setting `isDebug` to `true` will force Dojo to
77        //              pull in (and display) the version of Firebug Lite which is
78        //              integrated into the Dojo distribution, thereby always providing a
79        //              debugging/logging console when `isDebug` is enabled. Note that
80        //              Firebug's `console.*` methods are ALWAYS defined by Dojo. If
81        //              `isDebug` is false and you are on a platform without Firebug, these
82        //              methods will be defined as no-ops.
83        isDebug: false,
84        // locale: String
85        //              The locale to assume for loading localized resources in this page,
86        //              specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
87        //              Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
88        //              See the documentation for `dojo.i18n` and `dojo.requireLocalization`
89        //              for details on loading localized resources. If no locale is specified,
90        //              Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
91        //              or `navigator.language` properties.
92        locale: undefined,
93        // extraLocale: Array
94        //              No default value. Specifies additional locales whose
95        //              resources should also be loaded alongside the default locale when
96        //              calls to `dojo.requireLocalization()` are processed.
97        extraLocale: undefined,
98        // baseUrl: String
99        //              The directory in which `dojo.js` is located. Under normal
100        //              conditions, Dojo auto-detects the correct location from which it
101        //              was loaded. You may need to manually configure `baseUrl` in cases
102        //              where you have renamed `dojo.js` or in which `<base>` tags confuse
103        //              some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
104        //              either the value of `djConfig.baseUrl` if one is provided or the
105        //              auto-detected root if not. Other modules are located relative to
106        //              this path. The path should end in a slash.
107        baseUrl: undefined,
108        // modulePaths: Object
109        //              A map of module names to paths relative to `dojo.baseUrl`. The
110        //              key/value pairs correspond directly to the arguments which
111        //              `dojo.registerModulePath` accepts. Specifiying
112        //              `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
113        //              of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
114        //              modules may be configured via `djConfig.modulePaths`.
115        modulePaths: {},
116        // afterOnLoad: Boolean
117        //              Indicates Dojo was added to the page after the page load. In this case
118        //              Dojo will not wait for the page DOMContentLoad/load events and fire
119        //              its dojo.addOnLoad callbacks after making sure all outstanding
120        //              dojo.required modules have loaded. Only works with a built dojo.js,
121        //              it does not work the dojo.js directly from source control.
122        afterOnLoad: false,
123        // addOnLoad: Function or Array
124        //              Adds a callback via dojo.addOnLoad. Useful when Dojo is added after
125        //              the page loads and djConfig.afterOnLoad is true. Supports the same
126        //              arguments as dojo.addOnLoad. When using a function reference, use
127        //              `djConfig.addOnLoad = function(){};`. For object with function name use
128        //              `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
129        //              function reference use
130        //              `djConfig.addOnLoad = [myObject, function(){}];`
131        addOnLoad: null,
132        // require: Array
133        //              An array of module names to be loaded immediately after dojo.js has been included
134        //              in a page.
135        require: [],
136        // defaultDuration: Array
137        //              Default duration, in milliseconds, for wipe and fade animations within dijits.
138        //              Assigned to dijit.defaultDuration.
139        defaultDuration: 200,
140        // dojoBlankHtmlUrl: String
141        //              Used by some modules to configure an empty iframe. Used by dojo.io.iframe and
142        //              dojo.back, and dijit popup support in IE where an iframe is needed to make sure native
143        //              controls do not bleed through the popups. Normally this configuration variable
144        //              does not need to be set, except when using cross-domain/CDN Dojo builds.
145        //              Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
146        //              to the path on your domain your copy of blank.html.
147        dojoBlankHtmlUrl: undefined,
148        //      ioPublish: Boolean?
149        //              Set this to true to enable publishing of topics for the different phases of
150        //              IO operations. Publishing is done via dojo.publish. See dojo.__IoPublish for a list
151        //              of topics that are published.
152        ioPublish: false,
153        //      useCustomLogger: Anything?
154        //              If set to a value that evaluates to true such as a string or array and
155        //              isDebug is true and Firebug is not available or running, then it bypasses
156        //              the creation of Firebug Lite allowing you to define your own console object.
157        useCustomLogger: undefined,
158        // transparentColor: Array
159        //              Array containing the r, g, b components used as transparent color in dojo.Color;
160        //              if undefined, [255,255,255] (white) will be used.
161        transparentColor: undefined,
162        // skipIeDomLoaded: Boolean
163        //              For IE only, skip the DOMContentLoaded hack used. Sometimes it can cause an Operation
164        //              Aborted error if the rest of the page triggers script defers before the DOM is ready.
165        //              If this is config value is set to true, then dojo.addOnLoad callbacks will not be
166        //              triggered until the page load event, which is after images and iframes load. If you
167        //              want to trigger the callbacks sooner, you can put a script block in the bottom of
168        //              your HTML that calls dojo._loadInit();. If you are using multiversion support, change
169        //              "dojo." to the appropriate scope name for dojo.
170        skipIeDomLoaded: false
171}
172=====*/
173});
174
Note: See TracBrowser for help on using the repository browser.