Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / node_modules / video.js / es5 / tracks / text-track-list.js
1 'use strict';
2
3 exports.__esModule = true;
4
5 var _trackList = require('./track-list');
6
7 var _trackList2 = _interopRequireDefault(_trackList);
8
9 var _fn = require('../utils/fn.js');
10
11 var Fn = _interopRequireWildcard(_fn);
12
13 var _browser = require('../utils/browser.js');
14
15 var browser = _interopRequireWildcard(_browser);
16
17 var _document = require('global/document');
18
19 var _document2 = _interopRequireDefault(_document);
20
21 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; } }
22
23 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
24
25 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26
27 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; }
28
29 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; } /**
30                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 * @file text-track-list.js
31                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 */
32
33
34 /**
35  * The current list of {@link TextTrack} for a media file.
36  *
37  * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}
38  * @extends TrackList
39  */
40 var TextTrackList = function (_TrackList) {
41   _inherits(TextTrackList, _TrackList);
42
43   /**
44    * Create an instance of this class.
45    *
46    * @param {TextTrack[]} [tracks=[]]
47    *        A list of `TextTrack` to instantiate the list with.
48    */
49   function TextTrackList() {
50     var _this, _ret;
51
52     var tracks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
53
54     _classCallCheck(this, TextTrackList);
55
56     var list = void 0;
57
58     // IE8 forces us to implement inheritance ourselves
59     // as it does not support Object.defineProperty properly
60     if (browser.IS_IE8) {
61       list = _document2['default'].createElement('custom');
62       for (var prop in _trackList2['default'].prototype) {
63         if (prop !== 'constructor') {
64           list[prop] = _trackList2['default'].prototype[prop];
65         }
66       }
67       for (var _prop in TextTrackList.prototype) {
68         if (_prop !== 'constructor') {
69           list[_prop] = TextTrackList.prototype[_prop];
70         }
71       }
72     }
73
74     list = (_this = _possibleConstructorReturn(this, _TrackList.call(this, tracks, list)), _this);
75     return _ret = list, _possibleConstructorReturn(_this, _ret);
76   }
77
78   /**
79    * Add a {@link TextTrack} to the `TextTrackList`
80    *
81    * @param {TextTrack} track
82    *        The text track to add to the list.
83    *
84    * @fires TrackList#addtrack
85    * @private
86    */
87
88
89   TextTrackList.prototype.addTrack_ = function addTrack_(track) {
90     _TrackList.prototype.addTrack_.call(this, track);
91
92     /**
93      * @listens TextTrack#modechange
94      * @fires TrackList#change
95      */
96     track.addEventListener('modechange', Fn.bind(this, function () {
97       this.trigger('change');
98     }));
99   };
100
101   return TextTrackList;
102 }(_trackList2['default']);
103
104 exports['default'] = TextTrackList;