ContentActions.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. /**
  4. * Licensed Materials - Property of IBM
  5. * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', './api/ContentActionsAPI'], function (APIFactory, ContentActionsAPI) {
  9. var ContentActions = function () {
  10. function ContentActions() {
  11. _classCallCheck(this, ContentActions);
  12. this.api = APIFactory.createAPI(this, [ContentActionsAPI]);
  13. this.providers = {};
  14. }
  15. ContentActions.prototype.registerProvider = function registerProvider(name, provider) {
  16. this.providers[name] = provider;
  17. };
  18. ContentActions.prototype.getContentActionList = function getContentActionList(idList) {
  19. var contentActionList = [];
  20. Object.values(this.providers).forEach(function (provider) {
  21. if (provider.getContentActionList && typeof provider.getContentActionList === 'function') {
  22. var actions = null;
  23. try {
  24. actions = provider.getContentActionList(idList);
  25. } catch (e) {
  26. console.log(e);
  27. }
  28. if (actions) {
  29. contentActionList.push.apply(contentActionList, actions);
  30. }
  31. }
  32. });
  33. return contentActionList;
  34. };
  35. ContentActions.prototype.getAPI = function getAPI() {
  36. return this.api;
  37. };
  38. return ContentActions;
  39. }();
  40. return ContentActions;
  41. });
  42. //# sourceMappingURL=ContentActions.js.map