Commit 192af7a8 by polesye

Update docstrings.

parent f454e10e
...@@ -5,10 +5,10 @@ define( ...@@ -5,10 +5,10 @@ define(
function() { function() {
"use strict"; "use strict";
/** /**
* @desc Provides convenient way to work with iterate able data. * Provides convenient way to work with iterable data.
* * @exports video/00_iterator.js
* @constructor
* @param {array} list Array to be iterated. * @param {array} list Array to be iterated.
*
*/ */
var Iterator = function (list) { var Iterator = function (list) {
this.list = list; this.list = list;
...@@ -20,22 +20,19 @@ function() { ...@@ -20,22 +20,19 @@ function() {
Iterator.prototype = { Iterator.prototype = {
/** /**
* @desc Returns `true` if current index is valid for the iterator. * Checks validity of provided index for the iterator.
*
* @access protected * @access protected
* @returns {boolean} * @param {numebr} index
* * @return {boolean}
*/ */
_isValid: function (index) { _isValid: function (index) {
return _.isNumber(index) && index < this.size && index >= 0; return _.isNumber(index) && index < this.size && index >= 0;
}, },
/** /**
* @desc Returns next element. * Returns next element.
* * @param {number} [index] Updates current position.
* @param {number} index If set, updates current index of iterator. * @return {any}
* @returns {any}
*
*/ */
next: function (index) { next: function (index) {
if (!(this._isValid(index))) { if (!(this._isValid(index))) {
...@@ -48,11 +45,9 @@ function() { ...@@ -48,11 +45,9 @@ function() {
}, },
/** /**
* @desc Returns previous element. * Returns previous element.
* * @param {number} [index] Updates current position.
* @param {number} index If set, updates current index of iterator. * @return {any}
* @returns {any}
*
*/ */
prev: function (index) { prev: function (index) {
if (!(this._isValid(index))) { if (!(this._isValid(index))) {
...@@ -65,30 +60,24 @@ function() { ...@@ -65,30 +60,24 @@ function() {
}, },
/** /**
* @desc Returns last element in the list. * Returns last element in the list.
* * @return {any}
* @returns {any}
*
*/ */
last: function () { last: function () {
return this.list[this.lastIndex]; return this.list[this.lastIndex];
}, },
/** /**
* @desc Returns first element in the list. * Returns first element in the list.
* * @return {any}
* @returns {any}
*
*/ */
first: function () { first: function () {
return this.list[0]; return this.list[0];
}, },
/** /**
* @desc Returns `true` if current position is last for the iterator. * Returns `true` if current position is last for the iterator.
* * @return {boolean}
* @returns {boolean}
*
*/ */
isEnd: function () { isEnd: function () {
return this.index === this.lastIndex; return this.index === this.lastIndex;
......
...@@ -4,6 +4,12 @@ define( ...@@ -4,6 +4,12 @@ define(
['video/00_iterator.js'], ['video/00_iterator.js'],
function (Iterator) { function (Iterator) {
"use strict"; "use strict";
/**
* Video speed control module.
* @exports video/08_video_speed_control.js
* @constructor
* @param {object} state The object containing the state of the video player.
*/
var SpeedControl = function (state) { var SpeedControl = function (state) {
if (!(this instanceof SpeedControl)) { if (!(this instanceof SpeedControl)) {
return new SpeedControl(state); return new SpeedControl(state);
...@@ -17,10 +23,7 @@ function (Iterator) { ...@@ -17,10 +23,7 @@ function (Iterator) {
}; };
SpeedControl.prototype = { SpeedControl.prototype = {
/** /** Initializes the module. */
* @desc Initializes the module.
*
*/
initialize: function () { initialize: function () {
var state = this.state; var state = this.state;
...@@ -44,12 +47,10 @@ function (Iterator) { ...@@ -44,12 +47,10 @@ function (Iterator) {
}, },
/** /**
* @desc Create any necessary DOM elements, attach them, and set their, * Creates any necessary DOM elements, attach them, and set their,
* initial configuration. * initial configuration.
*
* @param {array} speeds List of speeds available for the player. * @param {array} speeds List of speeds available for the player.
* @param {string|number} currentSpeed Current speed for the player. * @param {string|number} currentSpeed Current speed for the player.
*
*/ */
render: function (speeds, currentSpeed) { render: function (speeds, currentSpeed) {
var self = this, var self = this,
...@@ -71,9 +72,8 @@ function (Iterator) { ...@@ -71,9 +72,8 @@ function (Iterator) {
}, },
/** /**
* @desc Bind any necessary function callbacks to DOM events (click, * Bind any necessary function callbacks to DOM events (click,
* mousemove, etc.). * mousemove, etc.).
*
*/ */
bindHandlers: function () { bindHandlers: function () {
var self = this; var self = this;
...@@ -104,18 +104,15 @@ function (Iterator) { ...@@ -104,18 +104,15 @@ function (Iterator) {
}, },
/** /**
* @desc Check if playbackRate supports by browser. * Check if playbackRate supports by browser. If browser supports, 1.0
* If browser supports, 1.0 should be returned by playbackRate * should be returned by playbackRate property. In this case, function
* property. In this case, function return True. Otherwise, False will * return True. Otherwise, False will be returned.
* be returned. * iOS doesn't support speed change.
* iOS doesn't support speed change. * @param {object} state The object containing the state of the video
* * player.
* @param {string} videoType Type of the video player * @return {boolean}
* * true: Browser support playbackRate functionality.
* @returns {boolean} * false: Browser doesn't support playbackRate functionality.
* true: Browser support playbackRate functionality.
* false: Browser doesn't support playbackRate functionality.
*
*/ */
isPlaybackRatesSupported: function (state) { isPlaybackRatesSupported: function (state) {
var isHtml5 = state.videoType === 'html5', var isHtml5 = state.videoType === 'html5',
...@@ -126,10 +123,8 @@ function (Iterator) { ...@@ -126,10 +123,8 @@ function (Iterator) {
}, },
/** /**
* @desc Opens speed menu. * Opens speed menu.
* * @param {boolean} [bindEvent] Click event will be attached on window.
* @param {boolean} bindEvent If set, attaches click event on window.
*
*/ */
openMenu: function (bindEvent) { openMenu: function (bindEvent) {
// When speed entries have focus, the menu stays open on // When speed entries have focus, the menu stays open on
...@@ -145,10 +140,8 @@ function (Iterator) { ...@@ -145,10 +140,8 @@ function (Iterator) {
}, },
/** /**
* @desc Closes speed menu. * Closes speed menu.
* * @param {boolean} [unBindEvent] Click event will be detached from window.
* @param {boolean} unBindEvent If set, detaches click event from window.
*
*/ */
closeMenu: function (unBindEvent) { closeMenu: function (unBindEvent) {
// Remove the previously added clickHandler from window element. // Remove the previously added clickHandler from window element.
...@@ -161,15 +154,13 @@ function (Iterator) { ...@@ -161,15 +154,13 @@ function (Iterator) {
}, },
/** /**
* @desc Sets new current speed for the speed control and triggers * Sets new current speed for the speed control and triggers `speedchange`
* `speedchange` event if needed. * event if needed.
*
* @param {string|number} speed Speed to be set. * @param {string|number} speed Speed to be set.
* @param {boolean} silent If set, sets new speed without triggering * @param {boolean} [silent] Sets the new speed without triggering
* `speedchange` event. * `speedchange` event.
* @param {boolean} forceUpdate If set, updates the speed even if it's * @param {boolean} [forceUpdate] Updates the speed even if it's
* not differs from current speed. * not differs from current speed.
*
*/ */
setSpeed: function (speed, silent, forceUpdate) { setSpeed: function (speed, silent, forceUpdate) {
if (speed !== this.currentSpeed || forceUpdate) { if (speed !== this.currentSpeed || forceUpdate) {
...@@ -189,10 +180,8 @@ function (Iterator) { ...@@ -189,10 +180,8 @@ function (Iterator) {
}, },
/** /**
* @desc Click event handler for the menu. * Click event handler for the menu.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
clickMenuHandler: function (event) { clickMenuHandler: function (event) {
this.closeMenu(); this.closeMenu();
...@@ -201,10 +190,8 @@ function (Iterator) { ...@@ -201,10 +190,8 @@ function (Iterator) {
}, },
/** /**
* @desc Click event handler for speed links. * Click event handler for speed links.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
clickLinkHandler: function (event) { clickLinkHandler: function (event) {
var speed = $(event.currentTarget).parent().data('speed'); var speed = $(event.currentTarget).parent().data('speed');
...@@ -216,10 +203,8 @@ function (Iterator) { ...@@ -216,10 +203,8 @@ function (Iterator) {
}, },
/** /**
* @desc Mouseenter event handler for the menu. * Mouseenter event handler for the menu.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
mouseEnterHandler: function (event) { mouseEnterHandler: function (event) {
this.openMenu(); this.openMenu();
...@@ -228,10 +213,8 @@ function (Iterator) { ...@@ -228,10 +213,8 @@ function (Iterator) {
}, },
/** /**
* @desc Mouseleave event handler for the menu. * Mouseleave event handler for the menu.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
mouseLeaveHandler: function (event) { mouseLeaveHandler: function (event) {
// Only close the menu is no speed entry has focus. // Only close the menu is no speed entry has focus.
...@@ -243,10 +226,8 @@ function (Iterator) { ...@@ -243,10 +226,8 @@ function (Iterator) {
}, },
/** /**
* @desc Keydown event handler for the menu. * Keydown event handler for the menu.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
keyDownMenuHandler: function (event) { keyDownMenuHandler: function (event) {
var KEY = $.ui.keyCode, var KEY = $.ui.keyCode,
...@@ -271,10 +252,8 @@ function (Iterator) { ...@@ -271,10 +252,8 @@ function (Iterator) {
    },     },
/** /**
* @desc Keydown event handler for speed links. * Keydown event handler for speed links.
*
* @param {jquery Event} event * @param {jquery Event} event
*
*/ */
keyDownLinkHandler: function (event) { keyDownLinkHandler: function (event) {
// ALT key is used to change (alternate) the function of // ALT key is used to change (alternate) the function of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment