LegacyBoardModule.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /*
  4. *+------------------------------------------------------------------------+
  5. *| Licensed Materials - Property of IBM
  6. *| IBM Cognos Products: Dashboard
  7. *| (C) Copyright IBM Corp. 2019
  8. *|
  9. *| US Government Users Restricted Rights - Use, duplication or disclosure
  10. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  11. *+------------------------------------------------------------------------+
  12. */
  13. define(['../../../lib/@waca/core-client/js/core-client/utils/ClassFactory'], function (ClassFactory) {
  14. var LegacyBoardModule = function () {
  15. function LegacyBoardModule(props) {
  16. _classCallCheck(this, LegacyBoardModule);
  17. props = props || {};
  18. this._loader = props.loader || ClassFactory;
  19. this.logger = props.logger;
  20. }
  21. LegacyBoardModule.prototype.load = function load(module) {
  22. var _this = this;
  23. var path = module.path || module;
  24. return this._loader.loadModule(path).then(function (ModuleClass) {
  25. return {
  26. template: ModuleClass.getTemplate,
  27. module: ModuleClass
  28. };
  29. }).catch(function (error) {
  30. _this.logger.warn('[LegacyBoardModule]: attempted to load module "' + path + ' and failed"', error);
  31. throw error;
  32. });
  33. };
  34. return LegacyBoardModule;
  35. }();
  36. return LegacyBoardModule;
  37. });
  38. //# sourceMappingURL=LegacyBoardModule.js.map