curl-amd
Version:
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
50 lines (40 loc) • 729 B
HTML
<html>
<head>
<title>apiName/apiContext curl test file</title>
<script>
foo = {};
curl = {
apiName: 'bar',
apiContext: foo,
paths: {
curl: '../src/curl/'
}
};
</script>
<script src="../src/curl.js" type="text/javascript"></script>
</head>
<body>
</body>
<script type="text/javascript">
var contextifiedCurl = foo.bar;
if(typeof contextifiedCurl !== 'function') {
write('FAILED: api context foo.bar');
}
else {
contextifiedCurl(
[
'stuff/three',
'domReady!'
]
).then(
function (three) {
write('SUCCESS: api context foo.bar');
}
);
}
function write (msg) {
document.body.appendChild(document.createElement('div')).innerHTML = msg;
}
</script>
</html>