Jsdoc updates

This commit is contained in:
Sam Potts 2019-02-23 13:07:35 +11:00
parent 4335a2a0d1
commit 438ebe5013
3 changed files with 43 additions and 43 deletions

View File

@ -17,7 +17,7 @@ import { buildUrlParams } from '../utils/urls';
class Ads { class Ads {
/** /**
* Ads constructor. * Ads constructor.
* @param {object} player * @param {Object} player
* @return {Ads} * @return {Ads}
*/ */
constructor(player) { constructor(player) {
@ -198,7 +198,7 @@ class Ads {
/** /**
* Update the ad countdown * Update the ad countdown
* @param {boolean} start * @param {Boolean} start
*/ */
pollCountdown(start = false) { pollCountdown(start = false) {
if (!start) { if (!start) {
@ -559,7 +559,7 @@ class Ads {
/** /**
* Handles callbacks after an ad event was invoked * Handles callbacks after an ad event was invoked
* @param {string} event - Event type * @param {String} event - Event type
*/ */
trigger(event, ...args) { trigger(event, ...args) {
const handlers = this.events[event]; const handlers = this.events[event];
@ -575,8 +575,8 @@ class Ads {
/** /**
* Add event listeners * Add event listeners
* @param {string} event - Event type * @param {String} event - Event type
* @param {function} callback - Callback for when event occurs * @param {Function} callback - Callback for when event occurs
* @return {Ads} * @return {Ads}
*/ */
on(event, callback) { on(event, callback) {
@ -594,8 +594,8 @@ class Ads {
* The advertisement has 12 seconds to get its things together. We stop this timer when the * The advertisement has 12 seconds to get its things together. We stop this timer when the
* advertisement is playing, or when a user action is required to start, then we clear the * advertisement is playing, or when a user action is required to start, then we clear the
* timer on ad ready * timer on ad ready
* @param {number} time * @param {Number} time
* @param {string} from * @param {String} from
*/ */
startSafetyTimer(time, from) { startSafetyTimer(time, from) {
this.player.debug.log(`Safety timer invoked from: ${from}`); this.player.debug.log(`Safety timer invoked from: ${from}`);
@ -608,7 +608,7 @@ class Ads {
/** /**
* Clear our safety timer(s) * Clear our safety timer(s)
* @param {string} from * @param {String} from
*/ */
clearSafetyTimer(from) { clearSafetyTimer(from) {
if (!is.nullOrUndefined(this.safetyTimer)) { if (!is.nullOrUndefined(this.safetyTimer)) {

View File

@ -403,7 +403,7 @@ class Plyr {
/** /**
* Toggle playback based on current status * Toggle playback based on current status
* @param {boolean} input * @param {Boolean} input
*/ */
togglePlay(input) { togglePlay(input) {
// Toggle based on current state if nothing passed // Toggle based on current state if nothing passed
@ -437,7 +437,7 @@ class Plyr {
/** /**
* Rewind * Rewind
* @param {number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime * @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
*/ */
rewind(seekTime) { rewind(seekTime) {
this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime); this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime);
@ -445,7 +445,7 @@ class Plyr {
/** /**
* Fast forward * Fast forward
* @param {number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime * @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
*/ */
forward(seekTime) { forward(seekTime) {
this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime); this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime);
@ -453,7 +453,7 @@ class Plyr {
/** /**
* Seek to a time * Seek to a time
* @param {number} input - where to seek to in seconds. Defaults to 0 (the start) * @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
*/ */
set currentTime(input) { set currentTime(input) {
// Bail if media duration isn't available yet // Bail if media duration isn't available yet
@ -523,7 +523,7 @@ class Plyr {
/** /**
* Set the player volume * Set the player volume
* @param {number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage * @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
*/ */
set volume(value) { set volume(value) {
let volume = value; let volume = value;
@ -574,7 +574,7 @@ class Plyr {
/** /**
* Increase volume * Increase volume
* @param {boolean} step - How much to decrease by (between 0 and 1) * @param {Boolean} step - How much to decrease by (between 0 and 1)
*/ */
increaseVolume(step) { increaseVolume(step) {
const volume = this.media.muted ? 0 : this.volume; const volume = this.media.muted ? 0 : this.volume;
@ -583,7 +583,7 @@ class Plyr {
/** /**
* Decrease volume * Decrease volume
* @param {boolean} step - How much to decrease by (between 0 and 1) * @param {Boolean} step - How much to decrease by (between 0 and 1)
*/ */
decreaseVolume(step) { decreaseVolume(step) {
this.increaseVolume(-step); this.increaseVolume(-step);
@ -591,7 +591,7 @@ class Plyr {
/** /**
* Set muted state * Set muted state
* @param {boolean} mute * @param {Boolean} mute
*/ */
set muted(mute) { set muted(mute) {
let toggle = mute; let toggle = mute;
@ -643,7 +643,7 @@ class Plyr {
/** /**
* Set playback speed * Set playback speed
* @param {number} speed - the speed of playback (0.5-2.0) * @param {Number} speed - the speed of playback (0.5-2.0)
*/ */
set speed(input) { set speed(input) {
let speed = null; let speed = null;
@ -690,7 +690,7 @@ class Plyr {
/** /**
* Set playback quality * Set playback quality
* Currently HTML5 & YouTube only * Currently HTML5 & YouTube only
* @param {number} input - Quality level * @param {Number} input - Quality level
*/ */
set quality(input) { set quality(input) {
const config = this.config.quality; const config = this.config.quality;
@ -740,7 +740,7 @@ class Plyr {
/** /**
* Toggle loop * Toggle loop
* TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
* @param {boolean} input - Whether to loop or not * @param {Boolean} input - Whether to loop or not
*/ */
set loop(input) { set loop(input) {
const toggle = is.boolean(input) ? input : this.config.loop.active; const toggle = is.boolean(input) ? input : this.config.loop.active;
@ -800,7 +800,7 @@ class Plyr {
/** /**
* Set new media source * Set new media source
* @param {object} input - The new source object (see docs) * @param {Object} input - The new source object (see docs)
*/ */
set source(input) { set source(input) {
source.change.call(this, input); source.change.call(this, input);
@ -824,7 +824,7 @@ class Plyr {
/** /**
* Set the poster image for a video * Set the poster image for a video
* @param {input} - the URL for the new poster image * @param {String} input - the URL for the new poster image
*/ */
set poster(input) { set poster(input) {
if (!this.isVideo) { if (!this.isVideo) {
@ -848,7 +848,7 @@ class Plyr {
/** /**
* Set the autoplay state * Set the autoplay state
* @param {boolean} input - Whether to autoplay or not * @param {Boolean} input - Whether to autoplay or not
*/ */
set autoplay(input) { set autoplay(input) {
const toggle = is.boolean(input) ? input : this.config.autoplay; const toggle = is.boolean(input) ? input : this.config.autoplay;
@ -864,7 +864,7 @@ class Plyr {
/** /**
* Toggle captions * Toggle captions
* @param {boolean} input - Whether to enable captions * @param {Boolean} input - Whether to enable captions
*/ */
toggleCaptions(input) { toggleCaptions(input) {
captions.toggle.call(this, input, false); captions.toggle.call(this, input, false);
@ -872,7 +872,7 @@ class Plyr {
/** /**
* Set the caption track by index * Set the caption track by index
* @param {number} - Caption index * @param {Number} - Caption index
*/ */
set currentTrack(input) { set currentTrack(input) {
captions.set.call(this, input, false); captions.set.call(this, input, false);
@ -889,7 +889,7 @@ class Plyr {
/** /**
* Set the wanted language for captions * Set the wanted language for captions
* Since tracks can be added later it won't update the actual caption track until there is a matching track * Since tracks can be added later it won't update the actual caption track until there is a matching track
* @param {string} - Two character ISO language code (e.g. EN, FR, PT, etc) * @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
*/ */
set language(input) { set language(input) {
captions.setLanguage.call(this, input, false); captions.setLanguage.call(this, input, false);
@ -962,7 +962,7 @@ class Plyr {
/** /**
* Toggle the player controls * Toggle the player controls
* @param {boolean} [toggle] - Whether to show the controls * @param {Boolean} [toggle] - Whether to show the controls
*/ */
toggleControls(toggle) { toggleControls(toggle) {
// Don't toggle if missing UI support or if it's audio // Don't toggle if missing UI support or if it's audio
@ -995,8 +995,8 @@ class Plyr {
/** /**
* Add event listeners * Add event listeners
* @param {string} event - Event type * @param {String} event - Event type
* @param {function} callback - Callback for when event occurs * @param {Function} callback - Callback for when event occurs
*/ */
on(event, callback) { on(event, callback) {
on.call(this, this.elements.container, event, callback); on.call(this, this.elements.container, event, callback);
@ -1004,8 +1004,8 @@ class Plyr {
/** /**
* Add event listeners once * Add event listeners once
* @param {string} event - Event type * @param {String} event - Event type
* @param {function} callback - Callback for when event occurs * @param {Function} callback - Callback for when event occurs
*/ */
once(event, callback) { once(event, callback) {
once.call(this, this.elements.container, event, callback); once.call(this, this.elements.container, event, callback);
@ -1013,8 +1013,8 @@ class Plyr {
/** /**
* Remove event listeners * Remove event listeners
* @param {string} event - Event type * @param {String} event - Event type
* @param {function} callback - Callback for when event occurs * @param {Function} callback - Callback for when event occurs
*/ */
off(event, callback) { off(event, callback) {
off(this.elements.container, event, callback); off(this.elements.container, event, callback);
@ -1024,8 +1024,8 @@ class Plyr {
* Destroy an instance * Destroy an instance
* Event listeners are removed when elements are removed * Event listeners are removed when elements are removed
* http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory * http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
* @param {function} callback - Callback for when destroy is complete * @param {Function} callback - Callback for when destroy is complete
* @param {boolean} soft - Whether it's a soft destroy (for source changes etc) * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
*/ */
destroy(callback, soft = false) { destroy(callback, soft = false) {
if (!this.ready) { if (!this.ready) {
@ -1124,7 +1124,7 @@ class Plyr {
/** /**
* Check for support for a mime type (HTML5 only) * Check for support for a mime type (HTML5 only)
* @param {string} type - Mime type * @param {String} type - Mime type
*/ */
supports(type) { supports(type) {
return support.mime.call(this, type); return support.mime.call(this, type);
@ -1132,9 +1132,9 @@ class Plyr {
/** /**
* Check for support * Check for support
* @param {string} type - Player type (audio/video) * @param {String} type - Player type (audio/video)
* @param {string} provider - Provider (html5/youtube/vimeo) * @param {String} provider - Provider (html5/youtube/vimeo)
* @param {bool} inline - Where player has `playsinline` sttribute * @param {Boolean} inline - Where player has `playsinline` sttribute
*/ */
static supported(type, provider, inline) { static supported(type, provider, inline) {
return support.check(type, provider, inline); return support.check(type, provider, inline);
@ -1142,8 +1142,8 @@ class Plyr {
/** /**
* Load an SVG sprite into the page * Load an SVG sprite into the page
* @param {string} url - URL for the SVG sprite * @param {String} url - URL for the SVG sprite
* @param {string} [id] - Unique ID * @param {String} [id] - Unique ID
*/ */
static loadSprite(url, id) { static loadSprite(url, id) {
return loadSprite(url, id); return loadSprite(url, id);
@ -1152,7 +1152,7 @@ class Plyr {
/** /**
* Setup multiple instances * Setup multiple instances
* @param {*} selector * @param {*} selector
* @param {object} options * @param {Object} options
*/ */
static setup(selector, options = {}) { static setup(selector, options = {}) {
let targets = null; let targets = null;

View File

@ -6,8 +6,8 @@ import is from './is';
/** /**
* Parse a string to a URL object * Parse a string to a URL object
* @param {string} input - the URL to be parsed * @param {String} input - the URL to be parsed
* @param {boolean} safe - failsafe parsing * @param {Boolean} safe - failsafe parsing
*/ */
export function parseUrl(input, safe = true) { export function parseUrl(input, safe = true) {
let url = input; let url = input;