main.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. define([
  2. "./_base/kernel", // kernel.isAsync
  3. "./has",
  4. "require",
  5. "./sniff",
  6. "./_base/lang",
  7. "./_base/array",
  8. "./_base/config",
  9. "./ready",
  10. "./_base/declare",
  11. "./_base/connect",
  12. "./_base/Deferred",
  13. "./_base/json",
  14. "./_base/Color",
  15. "./has!dojo-firebug?./_firebug/firebug",
  16. "./has!host-browser?./_base/browser",
  17. "./has!dojo-sync-loader?./_base/loader"
  18. ], function(kernel, has, require, sniff, lang, array, config, ready){
  19. // module:
  20. // dojo/main
  21. // summary:
  22. // This is the package main module for the dojo package; it loads dojo base appropriate for the execution environment.
  23. // the preferred way to load the dojo firebug console is by setting has("dojo-firebug") true in dojoConfig
  24. // the isDebug config switch is for backcompat and will work fine in sync loading mode; it works in
  25. // async mode too, but there's no guarantee when the module is loaded; therefore, if you need a firebug
  26. // console guaranteed at a particular spot in an app, either set config.has["dojo-firebug"] true before
  27. // loading dojo.js or explicitly include dojo/_firebug/firebug in a dependency list.
  28. if(config.isDebug){
  29. require(["./_firebug/firebug"]);
  30. }
  31. // dojoConfig.require is deprecated; use the loader configuration property deps
  32. has.add("dojo-config-require", 1);
  33. if(has("dojo-config-require")){
  34. var deps= config.require;
  35. if(deps){
  36. // config.require may be dot notation
  37. deps= array.map(lang.isArray(deps) ? deps : [deps], function(item){ return item.replace(/\./g, "/"); });
  38. if(kernel.isAsync){
  39. require(deps);
  40. }else{
  41. // this is a bit janky; in 1.6- dojo is defined before these requires are applied; but in 1.7+
  42. // dojo isn't defined until returning from this module; this is only a problem in sync mode
  43. // since we're in sync mode, we know we've got our loader with its priority ready queue
  44. ready(1, function(){require(deps);});
  45. }
  46. }
  47. }
  48. return kernel;
  49. });