Skip to content

Commit

Permalink
feat: Expose Tech#resize event as Player#resize (#3979)
Browse files Browse the repository at this point in the history
Rename Component's resize event to `componentresize` and trigger the Html5 specced resize event on the player.
  • Loading branch information
mister-ben authored and gkatsev committed Feb 3, 2017
1 parent 70d2eb1 commit e176b56
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
}
Expand All @@ -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'
Expand All @@ -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
Expand All @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
1 change: 1 addition & 0 deletions src/js/tech/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ Html5.Events = [
'play',
'pause',
'ratechange',
'resize',
'volumechange'
];

Expand Down

0 comments on commit e176b56

Please sign in to comment.