From 712dee003dd90f5d25047783f54e041119529721 Mon Sep 17 00:00:00 2001 From: Eric Fortmeyer Date: Thu, 23 Feb 2023 15:38:25 -0600 Subject: [PATCH] fix: remove deprecated `.extend` method Using classes inheritance instead of the deprecated `.extend` method will allow users of this library to upgrade VideoJS to version 8. See silvermine/videojs-chromecast#152 and silvermine/videojs-chromecast#147. Related to silvermine/videojs-chromecast#152, Related to silvermine/videojs-chromecast#147. --- src/js/components/AirPlayButton.js | 234 ++++++++++++++--------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/src/js/components/AirPlayButton.js b/src/js/components/AirPlayButton.js index 0fac589..ef27950 100644 --- a/src/js/components/AirPlayButton.js +++ b/src/js/components/AirPlayButton.js @@ -1,119 +1,6 @@ 'use strict'; -/** - * The AirPlayButton module contains both the AirPlayButton class definition and the - * function used to register the button as a Video.js Component. - * - * @module AirPlayButton - */ - -var hasAirPlayAPISupport = require('../lib/hasAirPlayAPISupport'), - AirPlayButton; - -/** -* The Video.js Button class is the base class for UI button components. -* -* @external Button -* @see {@link http://docs.videojs.com/Button.html|Button} -*/ - -/** @lends AirPlayButton.prototype */ -AirPlayButton = { - - /** - * This class is a button component designed to be displayed in the player UI's control - * bar. It displays an Apple AirPlay selection list when clicked. - * - * @constructs - * @extends external:Button - */ - constructor: function(player, options) { - this.constructor.super_.apply(this, arguments); - - if (!hasAirPlayAPISupport()) { - this.hide(); - } - - this._reactToAirPlayAvailableEvents(); - - if (options.addAirPlayLabelToButton) { - this.el().classList.add('vjs-airplay-button-lg'); - - this._labelEl = document.createElement('span'); - this._labelEl.classList.add('vjs-airplay-button-label'); - this._labelEl.textContent = this.localize('AirPlay'); - - this.el().appendChild(this._labelEl); - } else { - this.controlText('Start AirPlay'); - } - }, - - /** - * Overrides Button#buildCSSClass to return the classes used on the button element. - * - * @param {DOMElement} el - * @see {@link http://docs.videojs.com/Button.html#buildCSSClass|Button#buildCSSClass} - */ - buildCSSClass: function() { - return 'vjs-airplay-button ' + this.constructor.super_.prototype.buildCSSClass(); - }, - - /** - * Overrides Button#handleClick to handle button click events. AirPlay functionality is - * handled outside of this class, which should be limited to UI related logic. This - * function simply triggers an event on the player. - * - * @fires AirPlayButton#airPlayRequested - * @param {DOMElement} el - * @see {@link http://docs.videojs.com/Button.html#handleClick|Button#handleClick} - */ - handleClick: function() { - this.player().trigger('airPlayRequested'); - }, - - /** - * Gets the underlying DOMElement used by the player. - * - * @private - * @returns {DOMElement} either an