UNPKG

1.81 kBJavaScriptView Raw
1"use strict";
2var __rest = (this && this.__rest) || function (s, e) {
3 var t = {};
4 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5 t[p] = s[p];
6 if (s != null && typeof Object.getOwnPropertySymbols === "function")
7 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9 t[p[i]] = s[p[i]];
10 }
11 return t;
12};
13intern.registerLoader(function (options) {
14 var globalObj = typeof window !== 'undefined' ? window : global;
15 var _a = options.internLoaderPath, internLoaderPath = _a === void 0 ? 'node_modules/@dojo/loader/loader.js' : _a, loaderConfig = __rest(options, ["internLoaderPath"]);
16 return intern.loadScript(internLoaderPath).then(function () {
17 var require = globalObj.require;
18 intern.log('Using Dojo 2 loader');
19 loaderConfig.baseUrl = loaderConfig.baseUrl || intern.config.basePath;
20 intern.log('Configuring loader with:', loaderConfig);
21 require.config(loaderConfig);
22 return function (modules) {
23 var handle;
24 return new Promise(function (resolve, reject) {
25 handle = require.on('error', function (error) {
26 intern.emit('error', error);
27 reject(error);
28 });
29 intern.log('Loading modules:', modules);
30 require(modules, function () {
31 resolve();
32 });
33 }).then(function () {
34 handle.remove();
35 }, function (error) {
36 handle && handle.remove();
37 throw error;
38 });
39 };
40 });
41});
42//# sourceMappingURL=dojo2.js.map
\No newline at end of file