Skip to content

Commit

Permalink
Jsdoc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sampotts committed Feb 23, 2019
1 parent 4335a2a commit 438ebe5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 43 deletions.
16 changes: 8 additions & 8 deletions src/js/plugins/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { buildUrlParams } from '../utils/urls';
class Ads {
/**
* Ads constructor.
* @param {object} player
* @param {Object} player
* @return {Ads}
*/
constructor(player) {
Expand Down Expand Up @@ -198,7 +198,7 @@ class Ads {

/**
* Update the ad countdown
* @param {boolean} start
* @param {Boolean} start
*/
pollCountdown(start = false) {
if (!start) {
Expand Down Expand Up @@ -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];
Expand All @@ -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) {
Expand All @@ -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}`);
Expand All @@ -608,7 +608,7 @@ class Ads {

/**
* Clear our safety timer(s)
* @param {string} from
* @param {String} from
*/
clearSafetyTimer(from) {
if (!is.nullOrUndefined(this.safetyTimer)) {
Expand Down
66 changes: 33 additions & 33 deletions src/js/plyr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -437,23 +437,23 @@ 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);
}

/**
* 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);
}

/**
* 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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -583,15 +583,15 @@ 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);
}

/**
* Set muted state
* @param {boolean} mute
* @param {Boolean} mute
*/
set muted(mute) {
let toggle = mute;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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;
Expand All @@ -864,15 +864,15 @@ 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);
}

/**
* Set the caption track by index
* @param {number} - Caption index
* @param {Number} - Caption index
*/
set currentTrack(input) {
captions.set.call(this, input, false);
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -995,26 +995,26 @@ 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);
}

/**
* 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);
}

/**
* 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);
Expand All @@ -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) {
Expand Down Expand Up @@ -1124,26 +1124,26 @@ 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);
}

/**
* 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);
}

/**
* 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);
Expand All @@ -1152,7 +1152,7 @@ class Plyr {
/**
* Setup multiple instances
* @param {*} selector
* @param {object} options
* @param {Object} options
*/
static setup(selector, options = {}) {
let targets = null;
Expand Down
4 changes: 2 additions & 2 deletions src/js/utils/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 438ebe5

Please sign in to comment.