mirror of
https://github.com/systemjs/systemjs.git
synced 2026-01-18 14:53:14 +00:00
31 lines
857 B
JavaScript
31 lines
857 B
JavaScript
(function() {
|
|
var syncLoad = function(url) {
|
|
document.write('<' + 'script src="' + url + '">' + '<' + '/script>');
|
|
}
|
|
|
|
var scripts = document.getElementsByTagName('script');
|
|
var curScript = scripts[scripts.length - 1];
|
|
|
|
window.curMain = curScript.getAttribute('data-main')
|
|
|
|
var curURLParts = window.location.pathname.split('/');
|
|
|
|
while (curURLParts.pop() != 'tests-requirejs');
|
|
|
|
var testPath = curURLParts.join('/');
|
|
|
|
while (curURLParts.pop() != 'test');
|
|
|
|
var basePath = curURLParts.join('/');
|
|
curURLParts.pop();
|
|
var deepBasePath = curURLParts.join('/');
|
|
|
|
// load the es6 polyfill synchronously
|
|
syncLoad(deepBasePath + '/es6-module-loader/lib/es6-module-loader.js');
|
|
|
|
// then load jspm synchronously
|
|
syncLoad(basePath + '/loader.js');
|
|
|
|
// then wrap a dummy requirejs
|
|
syncLoad(testPath + '/requirejs-wrapper.js');
|
|
})(); |