DashboardStartupService.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: Content Explorer
  7. *| (C) Copyright IBM Corp. 2020
  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([], function () {
  14. /**
  15. * @class
  16. * @hideconstructor
  17. * @classdesc provides the core dashboard service to be used in glass customaization inside glass
  18. */
  19. var DashboardStartupService = function () {
  20. function DashboardStartupService() {
  21. _classCallCheck(this, DashboardStartupService);
  22. }
  23. /**
  24. * sets the dashbard core service which is available synchronously
  25. * waits for the DashboardUserProfile to be initialized
  26. * Important: initializing the UserProfileService cannot be expensive as this service is set as immediate
  27. * @param {Object} glassContext - glass context
  28. * @returns {Promise} resolved when the dashboard core service is set
  29. */
  30. DashboardStartupService.prototype.initialize = function initialize(glassContext) {
  31. return glassContext.getSvc('.DashboardUserProfileService').then(function (userProfileService) {
  32. var coreService = {
  33. getFeature: function getFeature(featureName) {
  34. var feature = void 0;
  35. if (featureName === 'UserProfile') {
  36. feature = userProfileService;
  37. } else {
  38. throw new Error('Unknown feature: ' + featureName);
  39. }
  40. return feature;
  41. }
  42. };
  43. glassContext.registerCoreService('.DashboardCoreService', coreService);
  44. });
  45. };
  46. return DashboardStartupService;
  47. }();
  48. return DashboardStartupService;
  49. });
  50. //# sourceMappingURL=DashboardStartupService.js.map