UNPKG

curl-amd

Version:

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

79 lines (66 loc) 1.82 kB
<!DOCTYPE HTML> <html> <head> <title>curl loading test for plain old javascript</title> <script> curl = { debug: true, paths: { curl: '../src/curl', test1: { location: 'stuff/plain_old.js', config: { loader: 'curl/loader/legacy', exports: 'testDomain.foo.bar' } }, definedUpTop : 'stuff/dep-on-test1-in-define', usingRequire : 'stuff/dep-on-test1' }, packages: [ { name: 'test2', location: 'stuff', main: 'plain_old_2', config: { loader: 'curl/loader/legacy', factory: function () { return testDomain.awesome; }, requires: ['test1'] } } ], pluginPath: 'curl/plugin', 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', 'test2', 'test1', 'definedUpTop', 'usingRequire' ] ).then( function (three, saucer, foobar,definedUpTop, usingRequire) { 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 js file with no deps return a value? ' + (foobar == 'whizzah!' ? 'SUCCESS' : 'FAILED')); write('Did module with non-amd deps load dep correctly? ' + (definedUpTop == 'whizzah!' ? 'SUCCESS' : 'FAILED')); write('Did module with non-amd deps load dep correctly? ' + (usingRequire == 'whizzah!' ? 'SUCCESS' : 'FAILED')); } ); function write (msg) { curl(['domReady!'], function () { document.body.appendChild(document.createElement('div')).innerHTML = msg; }) } </script> </head> <body> </body> </html>