curl-amd
Version:
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
44 lines (36 loc) • 942 B
HTML
<html>
<head>
<title>apiName/apiContext curl test file</title>
<script>
// simulate existing curl
function existingCurl () {}
curl = existingCurl;
</script>
<script src="../src/curl.js" type="text/javascript"></script>
<script type="text/javascript">
var foo = {},
cfg = {
apiName: 'bar',
apiContext: foo,
paths: {
curl: '../src/curl/'
}
};
curl(
cfg,
[ 'stuff/three', 'domReady!' ]
).then(
function (three) {
var restoredPrev, createdNew;
restoredPrev = curl == existingCurl ? 'SUCCESS' : 'FAILED';
createdNew = foo && foo.bar && typeof foo.bar == 'function' && foo.bar.version ? 'SUCCESS' : 'FAILED';
document.body.appendChild(document.createElement('div')).innerHTML = restoredPrev + ' previous global curl restored';
document.body.appendChild(document.createElement('div')).innerHTML = createdNew + ' new custom curl created';
}
);
</script>
</head>
<body>
</body>
</html>