MediaBase.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. 2014, 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define([], function () {
  9. var MediaBase = function () {
  10. function MediaBase(url, type) {
  11. _classCallCheck(this, MediaBase);
  12. this.url = url;
  13. this.type = type;
  14. }
  15. /**
  16. * Abstract: needs to be implemented by concrete subclass
  17. * @return an object with 'width' and 'height' members
  18. */
  19. MediaBase.prototype.getDimensions = function getDimensions() {
  20. return null;
  21. };
  22. /**
  23. * Abstract: needs to be implemented by concrete subclass
  24. * @param an object of parameters
  25. * @return the markup representing this media
  26. */
  27. MediaBase.prototype.getMarkup = function getMarkup() {
  28. return '';
  29. };
  30. /**
  31. * A callback for when markup is loaded into the DOM.
  32. * @param The root element into which the markup was placed
  33. */
  34. MediaBase.prototype.markupLoaded = function markupLoaded($el, mode) {
  35. if (mode === 'authoring') {
  36. this.showAuthoringMode();
  37. } else {
  38. this.showConsumeMode();
  39. }
  40. };
  41. /**
  42. * Invoke to render the media in authoring mode
  43. */
  44. MediaBase.prototype.showAuthoringMode = function showAuthoringMode() {};
  45. /**
  46. * Invoke to render the media in consume mode
  47. */
  48. MediaBase.prototype.showConsumeMode = function showConsumeMode() {};
  49. return MediaBase;
  50. }();
  51. return MediaBase;
  52. });
  53. //# sourceMappingURL=MediaBase.js.map