docs: update jsdoc comments

This commit is contained in:
LuanRT
2022-06-09 15:19:46 -03:00
parent bcaa02f10c
commit 049fd16aab
5 changed files with 28 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ class History {
/**
* @param {object} page - parsed data.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/

View File

@@ -10,7 +10,7 @@ class Library {
/**
* @param {object} response - API response.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @constructor
*/
constructor(response, actions) {

View File

@@ -10,7 +10,7 @@ class Search {
/**
* @param {object} response - API response.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/

View File

@@ -11,8 +11,8 @@ class VideoInfo {
/**
* @param {object} data - API response.
* @param {import('./Actions')} actions
* @param {import('./Player')} player
* @param {import('../../core/Actions')} actions
* @param {import('../../core/Player')} player
* @constructor
*/
constructor(data, actions, player) {
@@ -28,7 +28,7 @@ class VideoInfo {
throw new InnertubeError('This video is unavailable', info.playability_status);
/**
* @type {import('../parser/contents/classes/VideoDetails')}
* @type {import('../contents/classes/VideoDetails')}
*/
this.basic_info = {
...info.video_details,
@@ -46,17 +46,17 @@ class VideoInfo {
};
/**
* @type {import('../parser/contents/classes/VideoPrimaryInfo')}
* @type {import('../contents/classes/VideoPrimaryInfo')}
*/
this.primary_info = next.contents.results.get({ type: 'videoPrimaryInfoRenderer' });
/**
* @type {import('../parser/contents/classes/VideoSecondaryInfo')}
* @type {import('../contents/classes/VideoSecondaryInfo')}
*/
this.secondary_info = next.contents.results.get({ type: 'videoSecondaryInfoRenderer' });
/**
* @type {import('../parser/contents/classes/ChipCloud')}
* @type {import('../contents/classes/ChipCloud')}
*/
this.related_chip_cloud = next.contents.secondary_results.get({ type: 'relatedChipCloudRenderer' }).content;
@@ -64,7 +64,7 @@ class VideoInfo {
this.watch_next_feed.pop(); // get rid of the continuation item as it is of no use (for now).
/**
* @type {import('../parser/contents/classes/PlayerOverlay')}
* @type {import('../contents/classes/PlayerOverlay')}
*/
this.player_overlays = next.player_overlays;
@@ -76,34 +76,34 @@ class VideoInfo {
this.playability_status = info.playability_status;
/**
* @type {import('../parser/contents/classes/PlayerAnnotationsExpanded')[]}
* @type {import('../contents/classes/PlayerAnnotationsExpanded')[]}
*/
this.annotations = info.annotations;
/**
* @type {import('../parser/contents/classes/PlayerStoryboardSpec')}
* @type {import('../contents/classes/PlayerStoryboardSpec')}
*/
this.storyboards = info.storyboards;
/**
* @type {import('../parser/contents/classes/Endscreen')}
* @type {import('../contents/classes/Endscreen')}
*/
this.endscreen = info.endscreen;
/**
* @type {import('../parser/contents/classes/PlayerCaptionsTracklist')}
* @type {import('../contents/classes/PlayerCaptionsTracklist')}
*/
this.captions = info.captions;
/**
* @type {import('../parser/contents/classes/CardCollection')}
* @type {import('../contents/classes/CardCollection')}
*/
this.cards = info.cards;
const comments_entry_point = next.contents.results.get({ target_id: 'comments-entry-point' });
/**
* @type {import('../parser/contents/classes/CommentsEntryPointHeader')}
* @type {import('../contents/classes/CommentsEntryPointHeader')}
*/
this.comments_entry_point_header = comments_entry_point?.contents.get({ type: 'commentsEntryPointHeaderRenderer' }) || {};
}

View File

@@ -12,7 +12,7 @@ class Search {
/**
* @param {object} response - API response.
* @param {import('./Actions')} actions
* @param {import('../../core/Actions')} actions
* @param {boolean} is_continuation
* @constructor
*/
@@ -29,14 +29,14 @@ class Search {
const item_section = shelves.get({ type: 'itemSectionRenderer' });
/**
* @type {import('../parser/contents/classes/DidYouMean')}
* @type {import('../contents/classes/DidYouMean')}
*/
this.did_you_mean = item_section.contents.get({ type: 'didYouMeanRenderer' }) || null;
this.did_you_mean = item_section?.contents.get({ type: 'didYouMeanRenderer' }) || null;
/**
* @type {import('../parser/contents/classes/ShowingResultsFor')}
* @type {import('../contents/classes/ShowingResultsFor')}
*/
this.showing_results_for = item_section.contents.get({ type: 'showingResultsForRenderer' }) || null;
this.showing_results_for = item_section?.contents.get({ type: 'showingResultsForRenderer' }) || null;
this.did_you_mean || this.showing_results_for && shelves.shift();
@@ -81,27 +81,33 @@ class Search {
get has_continuation() {
return !!this.#continuation;
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get songs() {
return this.sections.get({ title: 'Songs' });
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get videos() {
return this.sections.get({ title: 'Videos' });
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get albums() {
return this.sections.get({ title: 'Albums' });
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get artists() {
return this.sections.get({ title: 'Artists' });
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get playlists() {
return this.sections.get({ title: 'Community playlists' });
}
/** @type {import('../contents/classes/MusicResponsiveListItem')[]} */
get page() {
return this.#page;
}