curl-amd
Version:
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
53 lines (42 loc) • 1.16 kB
HTML
<html>
<head>
<title>curl loading test for plain old javascript</title>
<script>
curl = {
debug: true,
paths: {
curl: '../src/curl'
},
prefetch: true
};
</script>
<script src="../src/curl.js" type="text/javascript"></script>
<!--<script src="../dist/curl-with-js-and-domReady/curl.js" type="text/javascript"></script>-->
<script type="text/javascript">
curl(
[
'stuff/three',
'js!stuff/plain_old.js!order!exports=testDomain.foo.bar',
'js!stuff/plain_old_2.js?foo!order',
'js!http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js',
'domReady!'
]
).then(
function (three, foobar) {
write('A module with dependencies loaded successfully if 3 == ' + three + '.');
write('If the following line says something then the plain js files loaded in the right order:');
write(testDomain.foo.bar + ' ' + testDomain.awesome.sauce);
write('Did !test option work? ' + (foobar == 'whizzah!' ? 'SUCCESS' : 'FAILED'));
}
);
function write (msg) {
curl(['domReady!'], function () {
document.body.appendChild(document.createElement('div')).innerHTML = msg;
})
}
</script>
</head>
<body>
</body>
</html>