Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the jsdoc comments to modern syntax - Part 6 #3771

Merged
merged 2 commits into from
Dec 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions src/js/control-bar/audio-track-controls/audio-track-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ import Component from '../../component.js';
import AudioTrackMenuItem from './audio-track-menu-item.js';

/**
* The base class for buttons that toggle specific text track types (e.g. subtitles)
* The base class for buttons that toggle specific {@link AudioTrack} types.
*
* @param {Player|Object} player
* @param {Object=} options
* @extends TrackButton
* @class AudioTrackButton
*/
class AudioTrackButton extends TrackButton {

/**
* Creates an instance of this class.
*
* @param {Player} player
* The `Player` that this class should be attached to.
*
* @param {Object} [options={}]
* The key/value store of player options.
*/
constructor(player, options = {}) {
options.tracks = player.audioTracks && player.audioTracks();

Expand All @@ -23,10 +30,10 @@ class AudioTrackButton extends TrackButton {
}

/**
* Allow sub components to stack CSS class names
* Builds the default DOM `className`.
*
* @return {String} The constructed class name
* @method buildCSSClass
* @return {string}
* The DOM `className` for this object.
*/
buildCSSClass() {
return `vjs-audio-button ${super.buildCSSClass()}`;
Expand All @@ -35,8 +42,11 @@ class AudioTrackButton extends TrackButton {
/**
* Create a menu item for each audio track
*
* @return {Array} Array of menu items
* @method createItems
* @param {AudioTrackMenuItem[]} [items=[]]
* An array of existing menu items to use.
*
* @return {AudioTrackMenuItem[]}
* An array of menu items
*/
createItems(items = []) {
const tracks = this.player_.audioTracks && this.player_.audioTracks();
Expand All @@ -58,6 +68,13 @@ class AudioTrackButton extends TrackButton {
return items;
}
}

/**
* The text that should display over the `AudioTrackButton`s controls. Added for localization.
*
* @type {string}
* @private
*/
AudioTrackButton.prototype.controlText_ = 'Audio Track';
Component.registerComponent('AudioTrackButton', AudioTrackButton);
export default AudioTrackButton;
32 changes: 24 additions & 8 deletions src/js/control-bar/audio-track-controls/audio-track-menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ import Component from '../../component.js';
import * as Fn from '../../utils/fn.js';

/**
* The audio track menu item
* An {@link AudioTrack} {@link MenuItem}
*
* @param {Player|Object} player
* @param {Object=} options
* @extends MenuItem
* @class AudioTrackMenuItem
*/
class AudioTrackMenuItem extends MenuItem {

/**
* Creates an instance of this class.
*
* @param {Player} player
* The `Player` that this class should be attached to.
*
* @param {Object} [options]
* The key/value store of player options.
*/
constructor(player, options) {
const track = options.track;
const tracks = player.audioTracks();
Expand All @@ -37,9 +44,15 @@ class AudioTrackMenuItem extends MenuItem {
}

/**
* Handle click on audio track
* This gets called when an `AudioTrackMenuItem is "clicked". See {@link ClickableComponent}
* for more detailed information on what a click can be.
*
* @param {EventTarget~Event} [event]
* The `keydown`, `tap`, or `click` event that caused this function to be
* called.
*
* @method handleClick
* @listens tap
* @listens click
*/
handleClick(event) {
const tracks = this.player_.audioTracks();
Expand All @@ -58,9 +71,12 @@ class AudioTrackMenuItem extends MenuItem {
}

/**
* Handle audio track change
* Handle any {@link AudioTrack} change.
*
* @param {EventTarget~Event} [event]
* The {@link AudioTrackList#change} event that caused this to run.
*
* @method handleTracksChange
* @listens AudioTrackList#change
*/
handleTracksChange(event) {
this.selected(this.track.enabled);
Expand Down
13 changes: 9 additions & 4 deletions src/js/control-bar/control-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ import './playback-rate-menu/playback-rate-menu-button.js';
import './spacer-controls/custom-control-spacer.js';

/**
* Container of main controls
* Container of main controls.
*
* @extends Component
* @class ControlBar
*/
class ControlBar extends Component {

/**
* Create the component's DOM element
* Create the `Component`'s DOM element
*
* @return {Element}
* @method createEl
* The element that was created.
*/
createEl() {
return super.createEl('div', {
Expand All @@ -48,6 +47,12 @@ class ControlBar extends Component {
}
}

/**
* Default options for `ControlBar`
*
* @type {Object}
* @private
*/
ControlBar.prototype.options_ = {
children: [
'playToggle',
Expand Down
46 changes: 36 additions & 10 deletions src/js/control-bar/fullscreen-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,62 @@ import Component from '../component.js';
* Toggle fullscreen video
*
* @extends Button
* @class FullscreenToggle
*/
class FullscreenToggle extends Button {

/**
* Creates an instance of this class.
*
* @param {Player} player
* The `Player` that this class should be attached to.
*
* @param {Object} [options]
* The key/value store of player options.
*/
constructor(player, options) {
super(player, options);
this.on(player, 'fullscreenchange', this.handleFullscreenChange);
}

/**
* Allow sub components to stack CSS class names
* Builds the default DOM `className`.
*
* @return {String} The constructed class name
* @method buildCSSClass
* @return {string}
* The DOM `className` for this object.
*/
buildCSSClass() {
return `vjs-fullscreen-control ${super.buildCSSClass()}`;
}

/**
* Handles Fullscreenchange on the component and change control text accordingly
* Handles fullscreenchange on the player and change control text accordingly.
*
* @param {EventTarget~Event} [event]
* The {@link Player#fullscreenchange} event that caused this function to be
* called.
*
* @method handleFullscreenChange
* @listens Player#fullscreenchange
*/
handleFullscreenChange() {
handleFullscreenChange(event) {
if (this.player_.isFullscreen()) {
this.controlText('Non-Fullscreen');
} else {
this.controlText('Fullscreen');
}
}

/**
* Handles click for full screen
* This gets called when an `FullscreenToggle` is "clicked". See
* {@link ClickableComponent} for more detailed information on what a click can be.
*
* @param {EventTarget~Event} [event]
* The `keydown`, `tap`, or `click` event that caused this function to be
* called.
*
* @method handleClick
* @listens tap
* @listens click
*/
handleClick() {
handleClick(event) {
if (!this.player_.isFullscreen()) {
this.player_.requestFullscreen();
} else {
Expand All @@ -53,6 +73,12 @@ class FullscreenToggle extends Button {

}

/**
* The text that should display over the `FullscreenToggle`s controls. Added for localization.
*
* @type {string}
* @private
*/
FullscreenToggle.prototype.controlText_ = 'Fullscreen';

Component.registerComponent('FullscreenToggle', FullscreenToggle);
Expand Down
30 changes: 24 additions & 6 deletions src/js/control-bar/live-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
import Component from '../component';
import * as Dom from '../utils/dom.js';

// TODO - Future make it click to snap to live

/**
* Displays the live indicator
* TODO - Future make it click to snap to live
* Displays the live indicator when duration is Infinity.
*
* @extends Component
* @class LiveDisplay
*/
class LiveDisplay extends Component {

/**
* Creates an instance of this class.
*
* @param {Player} player
* The `Player` that this class should be attached to.
*
* @param {Object} [options]
* The key/value store of player options.
*/
constructor(player, options) {
super(player, options);

Expand All @@ -21,10 +30,10 @@ class LiveDisplay extends Component {
}

/**
* Create the component's DOM element
* Create the `Component`'s DOM element
*
* @return {Element}
* @method createEl
* The element that was created.
*/
createEl() {
const el = super.createEl('div', {
Expand All @@ -42,7 +51,16 @@ class LiveDisplay extends Component {
return el;
}

updateShowing() {
/**
* Check the duration to see if the LiveDisplay should be showing or not. Then show/hide
* it accordingly
*
* @param {EventTarget~Event} [event]
* The {@link Player#durationchange} event that caused this function to run.
*
* @listens Player#durationchange
*/
updateShowing(event) {
if (this.player().duration() === Infinity) {
this.show();
} else {
Expand Down
48 changes: 35 additions & 13 deletions src/js/control-bar/mute-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ import Component from '../component';
import * as Dom from '../utils/dom.js';

/**
* A button component for muting the audio
* A button component for muting the audio.
*
* @param {Player|Object} player
* @param {Object=} options
* @extends Button
* @class MuteToggle
*/
class MuteToggle extends Button {

/**
* Creates an instance of this class.
*
* @param {Player} player
* The `Player` that this class should be attached to.
*
* @param {Object} [options]
* The key/value store of player options.
*/
constructor(player, options) {
super(player, options);

Expand All @@ -38,30 +44,40 @@ class MuteToggle extends Button {
}

/**
* Allow sub components to stack CSS class names
* Builds the default DOM `className`.
*
* @return {String} The constructed class name
* @method buildCSSClass
* @return {string}
* The DOM `className` for this object.
*/
buildCSSClass() {
return `vjs-mute-control ${super.buildCSSClass()}`;
}

/**
* Handle click on mute
* This gets called when an `MuteToggle` is "clicked". See
* {@link ClickableComponent} for more detailed information on what a click can be.
*
* @param {EventTarget~Event} [event]
* The `keydown`, `tap`, or `click` event that caused this function to be
* called.
*
* @method handleClick
* @listens tap
* @listens click
*/
handleClick() {
handleClick(event) {
this.player_.muted(this.player_.muted() ? false : true);
}

/**
* Update volume
* Update the state of volume.
*
* @method update
* @param {EventTarget~Event} [event]
* The {@link Player#loadstart} event if this function was called through an
* event.
*
* @listens Player#loadstart
*/
update() {
update(event) {
const vol = this.player_.volume();
let level = 3;

Expand Down Expand Up @@ -91,6 +107,12 @@ class MuteToggle extends Button {

}

/**
* The text that should display over the `MuteToggle`s controls. Added for localization.
*
* @type {string}
* @private
*/
MuteToggle.prototype.controlText_ = 'Mute';

Component.registerComponent('MuteToggle', MuteToggle);
Expand Down
Loading