1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-13 10:32:26 +02:00

feat: Expose Tech#resize event as Player#resize (#3979)

Rename Component's resize event to `componentresize` and trigger the Html5 specced resize event on the player.
This commit is contained in:
mister-ben 2017-02-03 21:32:41 +00:00 committed by Gary Katsevman
parent 70d2eb10cf
commit e176b56843
3 changed files with 24 additions and 7 deletions

View File

@ -790,7 +790,7 @@ class Component {
* The width that you want to set postfixed with '%', 'px' or nothing.
*
* @param {boolean} [skipListeners]
* Skip the resize event trigger
* Skip the componentresize event trigger
*
* @return {number|string}
* The width when getting, zero if there is no width. Can be a string
@ -808,7 +808,7 @@ class Component {
* The height that you want to set postfixed with '%', 'px' or nothing.
*
* @param {boolean} [skipListeners]
* Skip the resize event trigger
* Skip the componentresize event trigger
*
* @return {number|string}
* The width when getting, zero if there is no width. Can be a string
@ -828,7 +828,7 @@ class Component {
* Height to set the `Component`s element to.
*/
dimensions(width, height) {
// Skip resize listeners on width for optimization
// Skip componentresize listeners on width for optimization
this.width(width, true);
this.height(height);
}
@ -847,7 +847,7 @@ class Component {
* - If you want the computed style of the component, use {@link Component#currentWidth}
* and {@link {Component#currentHeight}
*
* @fires Component#resize
* @fires Component#componentresize
*
* @param {string} widthOrHeight
8 'width' or 'height'
@ -856,7 +856,7 @@ class Component {
8 New dimension
*
* @param {boolean} [skipListeners]
* Skip resize event trigger
* Skip componentresize event trigger
*
* @return {number}
* The dimension when getting or 0 if unset
@ -882,10 +882,10 @@ class Component {
/**
* Triggered when a component is resized.
*
* @event Component#resize
* @event Component#componentresize
* @type {EventTarget~Event}
*/
this.trigger('resize');
this.trigger('componentresize');
}
return;

View File

@ -191,6 +191,22 @@ const TECH_EVENTS_RETRIGGER = [
*/
'ratechange',
/**
* Fires when the video's intrinsic dimensions change
*
* @event Player#resize
* @type {event}
*/
/**
* Retrigger the `resize` event that was triggered by the {@link Tech}.
*
* @private
* @method Player#handleTechResize_
* @fires Player#resize
* @listens Tech#resize
*/
'resize',
/**
* Fires when the volume has been changed
*

View File

@ -848,6 +848,7 @@ Html5.Events = [
'play',
'pause',
'ratechange',
'resize',
'volumechange'
];