When using Dojo 1.6, I can “rename” the core dojo package like so:
<html>
<head>
<script type="text/javascript">
djConfig = {
baseUrl: 'https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/',
scopeMap: [
[ 'dojo', 'myDojo' ]
]
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"></script>
</head>
<body>
<script type="text/javascript">
if (typeof dojo != 'undefined') {
document.write("Defined: dojo: " + dojo.version + '\n');
}
if (typeof myDojo != 'undefined') {
document.write("Defined: myDojo: " + myDojo.version + '\n');
}
</script>
</body>
</html>
The above prints “Defined: myDojo: 1.6.1…”. How can I accomplish the same thing in Dojo 1.7? Following the example here, I tried this test, to no avail:
<html>
<head>
<script type="text/javascript">
dojoConfig = {
baseUrl: 'dojo/1.7.2/dojo/',
packages: [
{ name: 'myDojo',
location: '../dojo',
packageMap: {
dojo: 'myDojo'
}
}
]
}
</script>
<script src="dojo/1.7.2/dojo/dojo.js"></script>
</head>
<body>
<script type="text/javascript">
if (typeof dojo != "undefined") {
document.write("Defined: dojo: " + dojo.version + '\n');
}
if (typeof myDojo != "undefined") {
document.write("Defined: myDojo: " + myDojo.version + '\n');
}
</script>
</body>
</html>
This prints “Defined: dojo: 1.7.2…”. What am I missing?
to get the remapping of globals to work when using the source version, you need to set
dojoConfig.asyncto something truthy and then you need to load the'myDojo'package.http://jsfiddle.net/neonstalwart/44e56/ is a working example of the code below: