spacer.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _component = require('../../component.js');
  4. var _component2 = _interopRequireDefault(_component);
  5. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  6. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
  9. * @file spacer.js
  10. */
  11. /**
  12. * Just an empty spacer element that can be used as an append point for plugins, etc.
  13. * Also can be used to create space between elements when necessary.
  14. *
  15. * @extends Component
  16. */
  17. var Spacer = function (_Component) {
  18. _inherits(Spacer, _Component);
  19. function Spacer() {
  20. _classCallCheck(this, Spacer);
  21. return _possibleConstructorReturn(this, _Component.apply(this, arguments));
  22. }
  23. /**
  24. * Builds the default DOM `className`.
  25. *
  26. * @return {string}
  27. * The DOM `className` for this object.
  28. */
  29. Spacer.prototype.buildCSSClass = function buildCSSClass() {
  30. return 'vjs-spacer ' + _Component.prototype.buildCSSClass.call(this);
  31. };
  32. /**
  33. * Create the `Component`'s DOM element
  34. *
  35. * @return {Element}
  36. * The element that was created.
  37. */
  38. Spacer.prototype.createEl = function createEl() {
  39. return _Component.prototype.createEl.call(this, 'div', {
  40. className: this.buildCSSClass()
  41. });
  42. };
  43. return Spacer;
  44. }(_component2['default']);
  45. _component2['default'].registerComponent('Spacer', Spacer);
  46. exports['default'] = Spacer;