1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['require'], function (require) {
- 'use strict';
- /**
- * This loader does dynamic requires based on relative paths. It must be located under dashboard-analytics/,
- * all paths it requires are relative to dashboard-analytics/[module]
- */
- if (require.toUrl('./').indexOf('dashboard-analytics') === -1) {
- throw new Error('Loader.js MUST be in the dashboard-analytics folder');
- }
- return {
- _require: require,
- /**
- * Loads a module relative to dashboard core. DONT MOVE THIS FILE
- * @param array
- */
- load: function load(modules) {
- if (!Array.isArray(modules)) {
- throw new Error('modules must be an array');
- }
- var ModulesToLoad = [];
- modules.forEach(function (element) {
- if (!element || !element.length) {
- ModulesToLoad.push('');
- } else if (element.indexOf('text!') !== -1) {
- ModulesToLoad.push(element.replace('text!', 'text!../'));
- } else {
- ModulesToLoad.push('../' + element);
- }
- });
- var promises = [];
- var deferreds = [];
- ModulesToLoad.forEach(function () {
- var dfd = {};
- var promise = new Promise(function (resolve, reject) {
- dfd.resolve = resolve;
- dfd.reject = reject;
- });
- deferreds.push(dfd);
- promises.push(promise);
- });
- this._require(ModulesToLoad, function () {
- for (var i = 0; i < ModulesToLoad.length; i++) {
- deferreds[i].resolve(i < arguments.length ? arguments[i] : undefined);
- }
- }, function (err) {
- deferreds[0].reject(err);
- });
- return Promise.all(promises);
- }
- };
- });
- //# sourceMappingURL=DynamicFileLoader.js.map
|