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.

51 lines (42 loc) 890 B
<!DOCTYPE HTML> <html> <head> <title>defineName/defineContext curl test file</title> <script> foo = {}; curl = { defineName: 'defineModule', defineContext: foo, paths: { curl: '../src/curl/' } }; </script> <script src="../src/curl.js" type="text/javascript"></script> <script type="text/javascript"> curl(['stuff/foo.defineModule']).then( function (m) { if (m.msg) { write('SUCCESS: defineContext and defineName worked'); } else { write('FAILED: something went wrong'); } }, function (ex) { write('FAILED: ' + ex.message); } ); function write (msg) { // hack to get the domReady! plugin to work: define = foo.defineModule; // now we can use domReady!: curl('domReady!', function () { document.body.appendChild(document.createElement('div')).innerHTML = msg; }); } </script> </head> <body> </body> </html>