UNPKG

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