I’m delighted to read that require is now included in Dojo 1.7 (at least in the beta form).  Here is an example of why – to write some code, you just create a JavaScript file, name it “math.js” with the following:

	require([ "dojo" ], function (d) {
		console.debug(d.version); // todo: proper math here
	});
Then in another JavaScript file in the same folder:

	require([ "./math" ], function (m) {
		console.debug("loaded");
	});

Console shows the version details and then “loaded”.  Like magic. There is no need for any hardcoded namespacing or hairy module paths. Pretty cool huh?  (If you’re not a web developer, then this probably won’t :-) )

Advertisement