3 exports.__esModule = true;
5 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
7 var _log = require('./utils/log');
9 var _log2 = _interopRequireDefault(_log);
11 var _obj = require('./utils/obj');
13 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
21 * A combination of node inherits and babel's inherits (after transpile).
22 * Both work the same but node adds `super_` to the subClass
23 * and Bable adds the superClass as __proto__. Both seem useful.
25 * @param {Object} subClass
26 * The class to inherit to
28 * @param {Object} superClass
29 * The class to inherit from
33 var _inherits = function _inherits(subClass, superClass) {
34 if (typeof superClass !== 'function' && superClass !== null) {
35 throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass)));
38 subClass.prototype = Object.create(superClass && superClass.prototype, {
49 subClass.super_ = superClass;
54 * Function for subclassing using the same inheritance that
55 * videojs uses internally
57 * @param {Object} superClass
58 * The class to inherit from
60 * @param {Object} [subClassMethods={}]
61 * The class to inherit to
64 * The new object with subClassMethods that inherited superClass.
66 var extendFn = function extendFn(superClass) {
67 var subClassMethods = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
69 var subClass = function subClass() {
70 superClass.apply(this, arguments);
75 if ((0, _obj.isObject)(subClassMethods)) {
76 if (typeof subClassMethods.init === 'function') {
77 _log2['default'].warn('Constructor logic via init() is deprecated; please use constructor() instead.');
78 subClassMethods.constructor = subClassMethods.init;
80 if (subClassMethods.constructor !== Object.prototype.constructor) {
81 subClass = subClassMethods.constructor;
83 methods = subClassMethods;
84 } else if (typeof subClassMethods === 'function') {
85 subClass = subClassMethods;
88 _inherits(subClass, superClass);
90 // Extend subObj's prototype with functions and other properties from props
91 for (var name in methods) {
92 if (methods.hasOwnProperty(name)) {
93 subClass.prototype[name] = methods[name];
100 exports['default'] = extendFn;