3 exports.__esModule = true;
5 var _browser = require('../utils/browser.js');
7 var browser = _interopRequireWildcard(_browser);
9 var _document = require('global/document');
11 var _document2 = _interopRequireDefault(_document);
13 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
15 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
17 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /**
18 * @file text-track-cue-list.js
23 * @typedef {Object} TextTrackCue
25 * @property {string} id
26 * The unique id for this text track cue
28 * @property {number} startTime
29 * The start time for this text track cue
31 * @property {number} endTime
32 * The end time for this text track cue
34 * @property {boolean} pauseOnExit
35 * Pause when the end time is reached if true.
37 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}
41 * A List of TextTrackCues.
43 * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}
45 var TextTrackCueList = function () {
48 * Create an instance of this class..
51 * A list of cues to be initialized with
53 function TextTrackCueList(cues) {
54 _classCallCheck(this, TextTrackCueList);
56 var list = this; // eslint-disable-line
59 list = _document2['default'].createElement('custom');
61 for (var prop in TextTrackCueList.prototype) {
62 if (prop !== 'constructor') {
63 list[prop] = TextTrackCueList.prototype[prop];
68 TextTrackCueList.prototype.setCues_.call(list, cues);
71 * @member {number} length
72 * The current number of `TextTrackCue`s in the TextTrackCueList.
74 Object.defineProperty(list, 'length', {
86 * A setter for cues in this list. Creates getters
87 * an an index for the cues.
90 * An array of cues to set
96 TextTrackCueList.prototype.setCues_ = function setCues_(cues) {
97 var oldLength = this.length || 0;
102 this.length_ = cues.length;
104 var defineProp = function defineProp(index) {
105 if (!('' + index in this)) {
106 Object.defineProperty(this, '' + index, {
107 get: function get() {
108 return this.cues_[index];
118 defineProp.call(this, i);
124 * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.
127 * The id of the cue that should be searched for.
129 * @return {TextTrackCue|null}
130 * A single cue or null if none was found.
134 TextTrackCueList.prototype.getCueById = function getCueById(id) {
137 for (var i = 0, l = this.length; i < l; i++) {
149 return TextTrackCueList;
152 exports['default'] = TextTrackCueList;