coolio-dev-legacy-async.html 3.09 KB
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/claro/claro.css" />

		<script type="text/javascript">
			var startTime = (new Date()).getTime();
			var dojoConfig = {
				// this is an example of developing with synchronous modules
				async:0,

				// 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",
				},{
					// the dojox package which is always mapped when rescoping xdomain
					name:"dojox",
					location:"../../../../../dojox",
				},{
					// 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:"../../../.."
				},{
					// 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"
			    },{
					// 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:"."
				}],

				map:{
					cdojo:{dojo:"cdojo", dijit:"cdijit"},
					cdijit:{dojo:"cdojo", dijit:"cdijit"},
					coolio:{dojo:"cdojo", dijit:"cdijit"}
				}
			};
		</script>

		<!-- load the loader, which in sync mode, also loads dojo -->
		<script type="text/javascript" src="../../../../dojo.js"></script>
		<script type="text/javascript">
			dojo.require("cdojo");
			require({async:"legacyAsync"});
				
			// the next two dojo.requires load the dojo and dijit instances
			dojo.require("dijit.Calendar");
			dojo.require("dojo.parser");

			// coolio calendars loadn and are built on top of the cdojo and cdijit instances
			dojo.require("coolio.calendar");
			dojo.ready(function(){
				coolio.calendar("c1");
				dojo.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>