Icons.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Business Analytics (C) Copyright IBM Corp. 2020
  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', '../IconsAPI'], function (APIFactory, IconsAPI) {
  9. var Icons = function () {
  10. function Icons() {
  11. _classCallCheck(this, Icons);
  12. this._api = APIFactory.createAPI(this, [IconsAPI]);
  13. this._iconCache = {};
  14. }
  15. Icons.prototype.getAPI = function getAPI() {
  16. return this._api;
  17. };
  18. Icons.prototype.registerIcons = function registerIcons() {
  19. var _this = this;
  20. var iconList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  21. iconList.forEach(function (item) {
  22. if (item.icon) {
  23. _this._iconCache[item.id] = item.icon.default;
  24. } else if (item.icons) {
  25. _this._iconCache[item.id] = item.icons.default;
  26. }
  27. });
  28. };
  29. Icons.prototype.getIcon = function getIcon(iconId) {
  30. return this._iconCache[iconId];
  31. };
  32. return Icons;
  33. }();
  34. return Icons;
  35. });
  36. //# sourceMappingURL=Icons.js.map