mirror of
https://github.com/videojs/video.js.git
synced 2025-01-27 11:22:06 +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:
parent
70d2eb10cf
commit
e176b56843
@ -790,7 +790,7 @@ class Component {
|
|||||||
* The width that you want to set postfixed with '%', 'px' or nothing.
|
* The width that you want to set postfixed with '%', 'px' or nothing.
|
||||||
*
|
*
|
||||||
* @param {boolean} [skipListeners]
|
* @param {boolean} [skipListeners]
|
||||||
* Skip the resize event trigger
|
* Skip the componentresize event trigger
|
||||||
*
|
*
|
||||||
* @return {number|string}
|
* @return {number|string}
|
||||||
* The width when getting, zero if there is no width. Can be a 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.
|
* The height that you want to set postfixed with '%', 'px' or nothing.
|
||||||
*
|
*
|
||||||
* @param {boolean} [skipListeners]
|
* @param {boolean} [skipListeners]
|
||||||
* Skip the resize event trigger
|
* Skip the componentresize event trigger
|
||||||
*
|
*
|
||||||
* @return {number|string}
|
* @return {number|string}
|
||||||
* The width when getting, zero if there is no width. Can be a 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.
|
* Height to set the `Component`s element to.
|
||||||
*/
|
*/
|
||||||
dimensions(width, height) {
|
dimensions(width, height) {
|
||||||
// Skip resize listeners on width for optimization
|
// Skip componentresize listeners on width for optimization
|
||||||
this.width(width, true);
|
this.width(width, true);
|
||||||
this.height(height);
|
this.height(height);
|
||||||
}
|
}
|
||||||
@ -847,7 +847,7 @@ class Component {
|
|||||||
* - If you want the computed style of the component, use {@link Component#currentWidth}
|
* - If you want the computed style of the component, use {@link Component#currentWidth}
|
||||||
* and {@link {Component#currentHeight}
|
* and {@link {Component#currentHeight}
|
||||||
*
|
*
|
||||||
* @fires Component#resize
|
* @fires Component#componentresize
|
||||||
*
|
*
|
||||||
* @param {string} widthOrHeight
|
* @param {string} widthOrHeight
|
||||||
8 'width' or 'height'
|
8 'width' or 'height'
|
||||||
@ -856,7 +856,7 @@ class Component {
|
|||||||
8 New dimension
|
8 New dimension
|
||||||
*
|
*
|
||||||
* @param {boolean} [skipListeners]
|
* @param {boolean} [skipListeners]
|
||||||
* Skip resize event trigger
|
* Skip componentresize event trigger
|
||||||
*
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
* The dimension when getting or 0 if unset
|
* The dimension when getting or 0 if unset
|
||||||
@ -882,10 +882,10 @@ class Component {
|
|||||||
/**
|
/**
|
||||||
* Triggered when a component is resized.
|
* Triggered when a component is resized.
|
||||||
*
|
*
|
||||||
* @event Component#resize
|
* @event Component#componentresize
|
||||||
* @type {EventTarget~Event}
|
* @type {EventTarget~Event}
|
||||||
*/
|
*/
|
||||||
this.trigger('resize');
|
this.trigger('componentresize');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -191,6 +191,22 @@ const TECH_EVENTS_RETRIGGER = [
|
|||||||
*/
|
*/
|
||||||
'ratechange',
|
'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
|
* Fires when the volume has been changed
|
||||||
*
|
*
|
||||||
|
@ -848,6 +848,7 @@ Html5.Events = [
|
|||||||
'play',
|
'play',
|
||||||
'pause',
|
'pause',
|
||||||
'ratechange',
|
'ratechange',
|
||||||
|
'resize',
|
||||||
'volumechange'
|
'volumechange'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user