Consistently use @type for getter data types in JSDoc comments

Sometimes we also used `@return` or `@returns`, but `@type` is what
the JSDoc documentation recommends. This also improves the documentation
because before this commit the types were not shown and now they are.
This commit is contained in:
Tim van der Meij 2019-10-12 17:02:54 +02:00
parent f4daafc077
commit 8b4ae6f3eb
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
13 changed files with 56 additions and 56 deletions

View File

@ -253,7 +253,7 @@ class Annotation {
}
/**
* @return {boolean}
* @type {boolean}
*/
get viewable() {
if (this.flags === 0) {
@ -263,7 +263,7 @@ class Annotation {
}
/**
* @return {boolean}
* @type {boolean}
*/
get printable() {
if (this.flags === 0) {

View File

@ -568,8 +568,8 @@ var OperatorList = (function OperatorListClosure() {
},
/**
* @returns {number} The total length of the entire operator list,
* since `this.length === 0` after flushing.
* @type {number} The total length of the entire operator list, since
* `this.length === 0` after flushing.
*/
get totalLength() {
return (this._totalLength + this.length);

View File

@ -467,7 +467,7 @@ const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
/**
* Promise for document loading task completion.
* @return {Promise}
* @type {Promise}
*/
get promise() {
return this._capability.promise;
@ -591,14 +591,14 @@ class PDFDocumentProxy {
}
/**
* @return {number} Total number of pages the PDF contains.
* @type {number} Total number of pages the PDF contains.
*/
get numPages() {
return this._pdfInfo.numPages;
}
/**
* @return {string} A (not guaranteed to be) unique ID to identify a PDF.
* @type {string} A (not guaranteed to be) unique ID to identify a PDF.
*/
get fingerprint() {
return this._pdfInfo.fingerprint;
@ -780,16 +780,16 @@ class PDFDocumentProxy {
}
/**
* @return {Object} A subset of the current {DocumentInitParameters},
* which are either needed in the viewer and/or whose default values
* may be affected by the `apiCompatibilityParams`.
* @type {Object} A subset of the current {DocumentInitParameters}, which are
* either needed in the viewer and/or whose default values may be affected
* by the `apiCompatibilityParams`.
*/
get loadingParams() {
return this._transport.loadingParams;
}
/**
* @return {PDFDocumentLoadingTask} The loadingTask for the current document.
* @type {PDFDocumentLoadingTask} The loadingTask for the current document.
*/
get loadingTask() {
return this._transport.loadingTask;
@ -915,37 +915,37 @@ class PDFPageProxy {
}
/**
* @return {number} Page number of the page. First page is 1.
* @type {number} Page number of the page. First page is 1.
*/
get pageNumber() {
return this.pageIndex + 1;
}
/**
* @return {number} The number of degrees the page is rotated clockwise.
* @type {number} The number of degrees the page is rotated clockwise.
*/
get rotate() {
return this._pageInfo.rotate;
}
/**
* @return {Object} The reference that points to this page. It has 'num' and
* 'gen' properties.
* @type {Object} The reference that points to this page. It has `num` and
* `gen` properties.
*/
get ref() {
return this._pageInfo.ref;
}
/**
* @return {number} The default size of units in 1/72nds of an inch.
* @type {number} The default size of units in 1/72nds of an inch.
*/
get userUnit() {
return this._pageInfo.userUnit;
}
/**
* @return {Array} An array of the visible portion of the PDF page in the
* user space units - [x1, y1, x2, y2].
* @type {Array} An array of the visible portion of the PDF page in user
* space units [x1, y1, x2, y2].
*/
get view() {
return this._pageInfo.view;
@ -1406,7 +1406,7 @@ class PDFPageProxy {
}
/**
* @return {Object} Returns page stats, if enabled.
* @type {Object} Returns page stats, if enabled.
*/
get stats() {
return (this._stats instanceof StatTimer ? this._stats : null);
@ -2521,7 +2521,7 @@ class RenderTask {
/**
* Promise for rendering task completion.
* @return {Promise}
* @type {Promise}
*/
get promise() {
return this._internalRenderTask.capability.promise;

View File

@ -64,7 +64,7 @@ class IPDFStreamReader {
/**
* Gets a promise that is resolved when the headers and other metadata of
* the PDF data stream are available.
* @returns {Promise}
* @type {Promise}
*/
get headersReady() {
return Promise.resolve();
@ -73,8 +73,8 @@ class IPDFStreamReader {
/**
* Gets the Content-Disposition filename. It is defined after the headersReady
* promise is resolved.
* @returns {string|null} The filename, or `null` if the Content-Disposition
* header is missing/invalid.
* @type {string|null} The filename, or `null` if the Content-Disposition
* header is missing/invalid.
*/
get filename() {
return null;
@ -83,7 +83,7 @@ class IPDFStreamReader {
/**
* Gets PDF binary data length. It is defined after the headersReady promise
* is resolved.
* @returns {number} The data length (or 0 if unknown).
* @type {number} The data length (or 0 if unknown).
*/
get contentLength() {
return 0;
@ -93,7 +93,7 @@ class IPDFStreamReader {
* Gets ability of the stream to handle range requests. It is defined after
* the headersReady promise is resolved. Rejected when the reader is cancelled
* or an error occurs.
* @returns {boolean}
* @type {boolean}
*/
get isRangeSupported() {
return false;
@ -102,7 +102,7 @@ class IPDFStreamReader {
/**
* Gets ability of the stream to progressively load binary data. It is defined
* after the headersReady promise is resolved.
* @returns {boolean}
* @type {boolean}
*/
get isStreamingSupported() {
return false;
@ -143,7 +143,7 @@ class IPDFStreamRangeReader {
/**
* Gets ability of the stream to progressively load binary data.
* @returns {boolean}
* @type {boolean}
*/
get isStreamingSupported() {
return false;

View File

@ -178,14 +178,14 @@ class BaseViewer {
}
/**
* @returns {boolean} true if all {PDFPageView} objects are initialized.
* @type {boolean} - True if all {PDFPageView} objects are initialized.
*/
get pageViewsReady() {
return this._pageViewsReady;
}
/**
* @returns {number}
* @type {number}
*/
get currentPageNumber() {
return this._currentPageNumber;
@ -238,8 +238,8 @@ class BaseViewer {
}
/**
* @returns {string|null} Returns the current page label,
* or `null` if no page labels exist.
* @type {string|null} Returns the current page label, or `null` if no page
* labels exist.
*/
get currentPageLabel() {
return this._pageLabels && this._pageLabels[this._currentPageNumber - 1];
@ -267,7 +267,7 @@ class BaseViewer {
}
/**
* @returns {number}
* @type {number}
*/
get currentScale() {
return this._currentScale !== UNKNOWN_SCALE ? this._currentScale :
@ -288,7 +288,7 @@ class BaseViewer {
}
/**
* @returns {string}
* @type {string}
*/
get currentScaleValue() {
return this._currentScaleValue;
@ -305,7 +305,7 @@ class BaseViewer {
}
/**
* @returns {number}
* @type {number}
*/
get pagesRotation() {
return this._pagesRotation;
@ -1029,8 +1029,8 @@ class BaseViewer {
}
/**
* @returns {boolean} Whether all pages of the PDF document have identical
* widths and heights.
* @type {boolean} Whether all pages of the PDF document have identical
* widths and heights.
*/
get hasEqualPageSizes() {
let firstPageView = this._pages[0];
@ -1074,7 +1074,7 @@ class BaseViewer {
}
/**
* @return {number} One of the values in {ScrollMode}.
* @type {number} One of the values in {ScrollMode}.
*/
get scrollMode() {
return this._scrollMode;
@ -1120,7 +1120,7 @@ class BaseViewer {
}
/**
* @return {number} One of the values in {SpreadMode}.
* @type {number} One of the values in {SpreadMode}.
*/
get spreadMode() {
return this._spreadMode;

View File

@ -18,12 +18,12 @@
*/
class IPDFLinkService {
/**
* @returns {number}
* @type {number}
*/
get pagesCount() {}
/**
* @returns {number}
* @type {number}
*/
get page() {}
@ -33,7 +33,7 @@ class IPDFLinkService {
set page(value) {}
/**
* @returns {number}
* @type {number}
*/
get rotation() {}
@ -43,7 +43,7 @@ class IPDFLinkService {
set rotation(value) {}
/**
* @returns {boolean}
* @type {boolean}
*/
get externalLinkEnabled() {}
@ -117,12 +117,12 @@ class IPDFHistory {
*/
class IRenderableView {
/**
* @returns {string} - Unique ID for rendering queue.
* @type {string} - Unique ID for rendering queue.
*/
get renderingId() {}
/**
* @returns {RenderingStates}
* @type {RenderingStates}
*/
get renderingState() {}

View File

@ -55,7 +55,7 @@ class PDFCursorTools {
}
/**
* @returns {number} One of the values in {CursorTool}.
* @type {number} One of the values in {CursorTool}.
*/
get activeTool() {
return this.active;

View File

@ -223,7 +223,7 @@ class PDFFindController {
}
/**
* @return {string} The (current) normalized search query.
* @type {string} The (current) normalized search query.
*/
get _query() {
if (this._state.query !== this._rawQuery) {

View File

@ -272,7 +272,7 @@ class PDFHistory {
}
/**
* @returns {boolean} Indicating if the user is currently moving through the
* @type {boolean} Indicating if the user is currently moving through the
* browser history, useful e.g. for skipping the next 'hashchange' event.
*/
get popStateInProgress() {

View File

@ -64,14 +64,14 @@ class PDFLinkService {
}
/**
* @returns {number}
* @type {number}
*/
get pagesCount() {
return this.pdfDocument ? this.pdfDocument.numPages : 0;
}
/**
* @returns {number}
* @type {number}
*/
get page() {
return this.pdfViewer.currentPageNumber;
@ -85,7 +85,7 @@ class PDFLinkService {
}
/**
* @returns {number}
* @type {number}
*/
get rotation() {
return this.pdfViewer.pagesRotation;
@ -428,14 +428,14 @@ class SimpleLinkService {
}
/**
* @returns {number}
* @type {number}
*/
get pagesCount() {
return 0;
}
/**
* @returns {number}
* @type {number}
*/
get page() {
return 0;
@ -447,7 +447,7 @@ class SimpleLinkService {
set page(value) {}
/**
* @returns {number}
* @type {number}
*/
get rotation() {
return 0;

View File

@ -109,7 +109,7 @@ class PDFSidebar {
}
/**
* @returns {number} One of the values in {SidebarView}.
* @type {number} One of the values in {SidebarView}.
*/
get visibleView() {
return (this.isOpen ? this.active : SidebarView.NONE);

View File

@ -65,7 +65,7 @@ class PDFSidebarResizer {
}
/**
* returns {number}
* @type {number}
*/
get outerContainerWidth() {
if (!this._outerContainerWidth) {

View File

@ -132,7 +132,7 @@ class SecondaryToolbar {
}
/**
* @return {boolean}
* @type {boolean}
*/
get isOpen() {
return this.opened;