From 438ebe501320ac731aadcd94e7239a8778407b4a Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sat, 23 Feb 2019 13:07:35 +1100 Subject: [PATCH] Jsdoc updates --- src/js/plugins/ads.js | 16 +++++------ src/js/plyr.js | 66 +++++++++++++++++++++---------------------- src/js/utils/urls.js | 4 +-- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js index 6efd3295..c9256b0e 100644 --- a/src/js/plugins/ads.js +++ b/src/js/plugins/ads.js @@ -17,7 +17,7 @@ import { buildUrlParams } from '../utils/urls'; class Ads { /** * Ads constructor. - * @param {object} player + * @param {Object} player * @return {Ads} */ constructor(player) { @@ -198,7 +198,7 @@ class Ads { /** * Update the ad countdown - * @param {boolean} start + * @param {Boolean} start */ pollCountdown(start = false) { if (!start) { @@ -559,7 +559,7 @@ class Ads { /** * Handles callbacks after an ad event was invoked - * @param {string} event - Event type + * @param {String} event - Event type */ trigger(event, ...args) { const handlers = this.events[event]; @@ -575,8 +575,8 @@ class Ads { /** * Add event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs * @return {Ads} */ 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 * advertisement is playing, or when a user action is required to start, then we clear the * timer on ad ready - * @param {number} time - * @param {string} from + * @param {Number} time + * @param {String} from */ startSafetyTimer(time, from) { this.player.debug.log(`Safety timer invoked from: ${from}`); @@ -608,7 +608,7 @@ class Ads { /** * Clear our safety timer(s) - * @param {string} from + * @param {String} from */ clearSafetyTimer(from) { if (!is.nullOrUndefined(this.safetyTimer)) { diff --git a/src/js/plyr.js b/src/js/plyr.js index ebc3d1de..41a249bb 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -403,7 +403,7 @@ class Plyr { /** * Toggle playback based on current status - * @param {boolean} input + * @param {Boolean} input */ togglePlay(input) { // Toggle based on current state if nothing passed @@ -437,7 +437,7 @@ class Plyr { /** * 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) { this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime); @@ -445,7 +445,7 @@ class Plyr { /** * 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) { this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime); @@ -453,7 +453,7 @@ class Plyr { /** * 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) { // Bail if media duration isn't available yet @@ -523,7 +523,7 @@ class Plyr { /** * 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) { let volume = value; @@ -574,7 +574,7 @@ class Plyr { /** * 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) { const volume = this.media.muted ? 0 : this.volume; @@ -583,7 +583,7 @@ class Plyr { /** * 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) { this.increaseVolume(-step); @@ -591,7 +591,7 @@ class Plyr { /** * Set muted state - * @param {boolean} mute + * @param {Boolean} mute */ set muted(mute) { let toggle = mute; @@ -643,7 +643,7 @@ class Plyr { /** * 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) { let speed = null; @@ -690,7 +690,7 @@ class Plyr { /** * Set playback quality * Currently HTML5 & YouTube only - * @param {number} input - Quality level + * @param {Number} input - Quality level */ set quality(input) { const config = this.config.quality; @@ -740,7 +740,7 @@ class Plyr { /** * Toggle loop * 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) { const toggle = is.boolean(input) ? input : this.config.loop.active; @@ -800,7 +800,7 @@ class Plyr { /** * 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) { source.change.call(this, input); @@ -824,7 +824,7 @@ class Plyr { /** * 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) { if (!this.isVideo) { @@ -848,7 +848,7 @@ class Plyr { /** * Set the autoplay state - * @param {boolean} input - Whether to autoplay or not + * @param {Boolean} input - Whether to autoplay or not */ set autoplay(input) { const toggle = is.boolean(input) ? input : this.config.autoplay; @@ -864,7 +864,7 @@ class Plyr { /** * Toggle captions - * @param {boolean} input - Whether to enable captions + * @param {Boolean} input - Whether to enable captions */ toggleCaptions(input) { captions.toggle.call(this, input, false); @@ -872,7 +872,7 @@ class Plyr { /** * Set the caption track by index - * @param {number} - Caption index + * @param {Number} - Caption index */ set currentTrack(input) { captions.set.call(this, input, false); @@ -889,7 +889,7 @@ class Plyr { /** * 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 - * @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) { captions.setLanguage.call(this, input, false); @@ -962,7 +962,7 @@ class Plyr { /** * Toggle the player controls - * @param {boolean} [toggle] - Whether to show the controls + * @param {Boolean} [toggle] - Whether to show the controls */ toggleControls(toggle) { // Don't toggle if missing UI support or if it's audio @@ -995,8 +995,8 @@ class Plyr { /** * Add event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ on(event, callback) { on.call(this, this.elements.container, event, callback); @@ -1004,8 +1004,8 @@ class Plyr { /** * Add event listeners once - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ once(event, callback) { once.call(this, this.elements.container, event, callback); @@ -1013,8 +1013,8 @@ class Plyr { /** * Remove event listeners - * @param {string} event - Event type - * @param {function} callback - Callback for when event occurs + * @param {String} event - Event type + * @param {Function} callback - Callback for when event occurs */ off(event, callback) { off(this.elements.container, event, callback); @@ -1024,8 +1024,8 @@ class Plyr { * Destroy an instance * 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 - * @param {function} callback - Callback for when destroy is complete - * @param {boolean} soft - Whether it's a soft destroy (for source changes etc) + * @param {Function} callback - Callback for when destroy is complete + * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc) */ destroy(callback, soft = false) { if (!this.ready) { @@ -1124,7 +1124,7 @@ class Plyr { /** * Check for support for a mime type (HTML5 only) - * @param {string} type - Mime type + * @param {String} type - Mime type */ supports(type) { return support.mime.call(this, type); @@ -1132,9 +1132,9 @@ class Plyr { /** * Check for support - * @param {string} type - Player type (audio/video) - * @param {string} provider - Provider (html5/youtube/vimeo) - * @param {bool} inline - Where player has `playsinline` sttribute + * @param {String} type - Player type (audio/video) + * @param {String} provider - Provider (html5/youtube/vimeo) + * @param {Boolean} inline - Where player has `playsinline` sttribute */ static supported(type, provider, inline) { return support.check(type, provider, inline); @@ -1142,8 +1142,8 @@ class Plyr { /** * Load an SVG sprite into the page - * @param {string} url - URL for the SVG sprite - * @param {string} [id] - Unique ID + * @param {String} url - URL for the SVG sprite + * @param {String} [id] - Unique ID */ static loadSprite(url, id) { return loadSprite(url, id); @@ -1152,7 +1152,7 @@ class Plyr { /** * Setup multiple instances * @param {*} selector - * @param {object} options + * @param {Object} options */ static setup(selector, options = {}) { let targets = null; diff --git a/src/js/utils/urls.js b/src/js/utils/urls.js index 3ebe622e..843c6aa6 100644 --- a/src/js/utils/urls.js +++ b/src/js/utils/urls.js @@ -6,8 +6,8 @@ import is from './is'; /** * Parse a string to a URL object - * @param {string} input - the URL to be parsed - * @param {boolean} safe - failsafe parsing + * @param {String} input - the URL to be parsed + * @param {Boolean} safe - failsafe parsing */ export function parseUrl(input, safe = true) { let url = input;