coolio-dev-async-with-packageMap.html
2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/claro/claro.css" />
<!-- configure the loader to create two instance of dojo and dijit, the second instances relocated to cdojo and- cdijit, repsectively-->
<script type="text/javascript">
var startTime = (new Date()).getTime();
var dojoConfig = {
// this is an example of developing with AMD modules
async:1,
// set baseUrl === to the page URL; this overrides dojo's desire to be the center of the world
baseUrl:".",
packages:[{
// the dojo package for non-coolio use
name:"dojo",
location:"../../../..",
},{
// the dijit package for non-coolio use
name:"dijit",
location:"../../../../../dijit",
},{
// sandboxed, separate instance dojo package for coolio use; notice it uses the same code as the non-coolie dojo package
// all "dojo*" modules ids are mapped to "cdojo*" within this package
name:"cdojo",
location:"../../../..",
packageMap:{dojo:"cdojo", dijit:"cdijit"}
},{
// sandboxed, separate instance dijit package for coolio use; notice it uses the same code as the non-coolie dijitpackage
// all "dojo*" modules ids are mapped to "cdojo*" within this package
// all "dijit*" modules ids are mapped to "cdijit*" within this package
name:"cdijit",
location:"../../../../../dijit",
packageMap:{dojo:"cdojo", dijit:"cdijit"}
},{
// all "dojo*" modules ids are mapped to "cdojo*" within this package
// all "dijit*" modules ids are mapped to "cdijit*" within this package
name:"coolio",
location:".",
packageMap:{dojo:"cdojo", dijit:"cdijit"}
}],
};
</script>
<script type="text/javascript" src="../../../../dojo.js"></script>
<script type="text/javascript">
require(["coolio/calendar-amd", "dojo/parser", "dijit/Calendar", "dojo/domReady!"], function(calendar, parser){
calendar("c1");
parser.parse();
console.log("total load time: " + ((new Date()).getTime() - startTime) / 1000 + "s");
console.log(dojo);
console.log(dijit);
console.log(cdojo);
console.log(cdijit);
console.log("dojo._scopeName=" + dojo._scopeName);
console.log("cdojo._scopeName=" + cdojo._scopeName);
console.log("dijit._scopeName=" + dijit._scopeName);
console.log("cdijit._scopeName=" + cdijit._scopeName);
});
</script>
</head>
<body class=" claro ">
<!-- see it all work: instantiate a couple of widgets, one built in the dojo, dijit stack, the other in the cdojo, cdijit, coolio stack -->
<p>A Coolio Calendar</p>
<div id="c1"></div>
<p>A Dijit Calendar</p>
<div dojoType="dijit.Calendar" onChange="dojo.byId('formatted').innerHTML=dojo.date.locale.format(arguments[0], {formatLength: 'full', selector:'date'})"> </div>
</body>
</html>