mirror of
https://github.com/videojs/video.js.git
synced 2025-01-04 06:48:49 +02:00
fix: deprecate the extend() function (#7944)
This function will be removed in Video.js 8.0
This commit is contained in:
parent
ce1baba3cb
commit
b58a2201c4
@ -4,12 +4,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import _inherits from '@babel/runtime/helpers/inherits';
|
import _inherits from '@babel/runtime/helpers/inherits';
|
||||||
|
import log from './utils/log.js';
|
||||||
|
|
||||||
|
let hasLogged = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to subclass an existing class by emulating ES subclassing using the
|
* Used to subclass an existing class by emulating ES subclassing using the
|
||||||
* `extends` keyword.
|
* `extends` keyword.
|
||||||
*
|
*
|
||||||
* @function
|
* @function
|
||||||
|
* @deprecated
|
||||||
* @example
|
* @example
|
||||||
* var MyComponent = videojs.extend(videojs.getComponent('Component'), {
|
* var MyComponent = videojs.extend(videojs.getComponent('Component'), {
|
||||||
* myCustomMethod: function() {
|
* myCustomMethod: function() {
|
||||||
@ -27,6 +31,15 @@ import _inherits from '@babel/runtime/helpers/inherits';
|
|||||||
* The new class with subClassMethods that inherited superClass.
|
* The new class with subClassMethods that inherited superClass.
|
||||||
*/
|
*/
|
||||||
const extend = function(superClass, subClassMethods = {}) {
|
const extend = function(superClass, subClassMethods = {}) {
|
||||||
|
|
||||||
|
// Log a warning the first time extend is called to note that it is deprecated
|
||||||
|
// It was previously deprecated in our documentation (guides, specifically),
|
||||||
|
// but was never formally deprecated in code.
|
||||||
|
if (!hasLogged) {
|
||||||
|
log.warn('videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0');
|
||||||
|
hasLogged = true;
|
||||||
|
}
|
||||||
|
|
||||||
let subClass = function() {
|
let subClass = function() {
|
||||||
superClass.apply(this, arguments);
|
superClass.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user