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:
parent
f4daafc077
commit
8b4ae6f3eb
@ -253,7 +253,7 @@ class Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get viewable() {
|
get viewable() {
|
||||||
if (this.flags === 0) {
|
if (this.flags === 0) {
|
||||||
@ -263,7 +263,7 @@ class Annotation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get printable() {
|
get printable() {
|
||||||
if (this.flags === 0) {
|
if (this.flags === 0) {
|
||||||
|
@ -568,8 +568,8 @@ var OperatorList = (function OperatorListClosure() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number} The total length of the entire operator list,
|
* @type {number} The total length of the entire operator list, since
|
||||||
* since `this.length === 0` after flushing.
|
* `this.length === 0` after flushing.
|
||||||
*/
|
*/
|
||||||
get totalLength() {
|
get totalLength() {
|
||||||
return (this._totalLength + this.length);
|
return (this._totalLength + this.length);
|
||||||
|
@ -467,7 +467,7 @@ const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Promise for document loading task completion.
|
* Promise for document loading task completion.
|
||||||
* @return {Promise}
|
* @type {Promise}
|
||||||
*/
|
*/
|
||||||
get promise() {
|
get promise() {
|
||||||
return this._capability.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() {
|
get numPages() {
|
||||||
return this._pdfInfo.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() {
|
get fingerprint() {
|
||||||
return this._pdfInfo.fingerprint;
|
return this._pdfInfo.fingerprint;
|
||||||
@ -780,16 +780,16 @@ class PDFDocumentProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Object} A subset of the current {DocumentInitParameters},
|
* @type {Object} A subset of the current {DocumentInitParameters}, which are
|
||||||
* which are either needed in the viewer and/or whose default values
|
* either needed in the viewer and/or whose default values may be affected
|
||||||
* may be affected by the `apiCompatibilityParams`.
|
* by the `apiCompatibilityParams`.
|
||||||
*/
|
*/
|
||||||
get loadingParams() {
|
get loadingParams() {
|
||||||
return this._transport.loadingParams;
|
return this._transport.loadingParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {PDFDocumentLoadingTask} The loadingTask for the current document.
|
* @type {PDFDocumentLoadingTask} The loadingTask for the current document.
|
||||||
*/
|
*/
|
||||||
get loadingTask() {
|
get loadingTask() {
|
||||||
return this._transport.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() {
|
get pageNumber() {
|
||||||
return this.pageIndex + 1;
|
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() {
|
get rotate() {
|
||||||
return this._pageInfo.rotate;
|
return this._pageInfo.rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Object} The reference that points to this page. It has 'num' and
|
* @type {Object} The reference that points to this page. It has `num` and
|
||||||
* 'gen' properties.
|
* `gen` properties.
|
||||||
*/
|
*/
|
||||||
get ref() {
|
get ref() {
|
||||||
return this._pageInfo.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() {
|
get userUnit() {
|
||||||
return this._pageInfo.userUnit;
|
return this._pageInfo.userUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array} An array of the visible portion of the PDF page in the
|
* @type {Array} An array of the visible portion of the PDF page in user
|
||||||
* user space units - [x1, y1, x2, y2].
|
* space units [x1, y1, x2, y2].
|
||||||
*/
|
*/
|
||||||
get view() {
|
get view() {
|
||||||
return this._pageInfo.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() {
|
get stats() {
|
||||||
return (this._stats instanceof StatTimer ? this._stats : null);
|
return (this._stats instanceof StatTimer ? this._stats : null);
|
||||||
@ -2521,7 +2521,7 @@ class RenderTask {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Promise for rendering task completion.
|
* Promise for rendering task completion.
|
||||||
* @return {Promise}
|
* @type {Promise}
|
||||||
*/
|
*/
|
||||||
get promise() {
|
get promise() {
|
||||||
return this._internalRenderTask.capability.promise;
|
return this._internalRenderTask.capability.promise;
|
||||||
|
@ -64,7 +64,7 @@ class IPDFStreamReader {
|
|||||||
/**
|
/**
|
||||||
* Gets a promise that is resolved when the headers and other metadata of
|
* Gets a promise that is resolved when the headers and other metadata of
|
||||||
* the PDF data stream are available.
|
* the PDF data stream are available.
|
||||||
* @returns {Promise}
|
* @type {Promise}
|
||||||
*/
|
*/
|
||||||
get headersReady() {
|
get headersReady() {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
@ -73,8 +73,8 @@ class IPDFStreamReader {
|
|||||||
/**
|
/**
|
||||||
* Gets the Content-Disposition filename. It is defined after the headersReady
|
* Gets the Content-Disposition filename. It is defined after the headersReady
|
||||||
* promise is resolved.
|
* promise is resolved.
|
||||||
* @returns {string|null} The filename, or `null` if the Content-Disposition
|
* @type {string|null} The filename, or `null` if the Content-Disposition
|
||||||
* header is missing/invalid.
|
* header is missing/invalid.
|
||||||
*/
|
*/
|
||||||
get filename() {
|
get filename() {
|
||||||
return null;
|
return null;
|
||||||
@ -83,7 +83,7 @@ class IPDFStreamReader {
|
|||||||
/**
|
/**
|
||||||
* Gets PDF binary data length. It is defined after the headersReady promise
|
* Gets PDF binary data length. It is defined after the headersReady promise
|
||||||
* is resolved.
|
* is resolved.
|
||||||
* @returns {number} The data length (or 0 if unknown).
|
* @type {number} The data length (or 0 if unknown).
|
||||||
*/
|
*/
|
||||||
get contentLength() {
|
get contentLength() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -93,7 +93,7 @@ class IPDFStreamReader {
|
|||||||
* Gets ability of the stream to handle range requests. It is defined after
|
* Gets ability of the stream to handle range requests. It is defined after
|
||||||
* the headersReady promise is resolved. Rejected when the reader is cancelled
|
* the headersReady promise is resolved. Rejected when the reader is cancelled
|
||||||
* or an error occurs.
|
* or an error occurs.
|
||||||
* @returns {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get isRangeSupported() {
|
get isRangeSupported() {
|
||||||
return false;
|
return false;
|
||||||
@ -102,7 +102,7 @@ class IPDFStreamReader {
|
|||||||
/**
|
/**
|
||||||
* Gets ability of the stream to progressively load binary data. It is defined
|
* Gets ability of the stream to progressively load binary data. It is defined
|
||||||
* after the headersReady promise is resolved.
|
* after the headersReady promise is resolved.
|
||||||
* @returns {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get isStreamingSupported() {
|
get isStreamingSupported() {
|
||||||
return false;
|
return false;
|
||||||
@ -143,7 +143,7 @@ class IPDFStreamRangeReader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets ability of the stream to progressively load binary data.
|
* Gets ability of the stream to progressively load binary data.
|
||||||
* @returns {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get isStreamingSupported() {
|
get isStreamingSupported() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -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() {
|
get pageViewsReady() {
|
||||||
return this._pageViewsReady;
|
return this._pageViewsReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get currentPageNumber() {
|
get currentPageNumber() {
|
||||||
return this._currentPageNumber;
|
return this._currentPageNumber;
|
||||||
@ -238,8 +238,8 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string|null} Returns the current page label,
|
* @type {string|null} Returns the current page label, or `null` if no page
|
||||||
* or `null` if no page labels exist.
|
* labels exist.
|
||||||
*/
|
*/
|
||||||
get currentPageLabel() {
|
get currentPageLabel() {
|
||||||
return this._pageLabels && this._pageLabels[this._currentPageNumber - 1];
|
return this._pageLabels && this._pageLabels[this._currentPageNumber - 1];
|
||||||
@ -267,7 +267,7 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get currentScale() {
|
get currentScale() {
|
||||||
return this._currentScale !== UNKNOWN_SCALE ? this._currentScale :
|
return this._currentScale !== UNKNOWN_SCALE ? this._currentScale :
|
||||||
@ -288,7 +288,7 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
get currentScaleValue() {
|
get currentScaleValue() {
|
||||||
return this._currentScaleValue;
|
return this._currentScaleValue;
|
||||||
@ -305,7 +305,7 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get pagesRotation() {
|
get pagesRotation() {
|
||||||
return this._pagesRotation;
|
return this._pagesRotation;
|
||||||
@ -1029,8 +1029,8 @@ class BaseViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean} Whether all pages of the PDF document have identical
|
* @type {boolean} Whether all pages of the PDF document have identical
|
||||||
* widths and heights.
|
* widths and heights.
|
||||||
*/
|
*/
|
||||||
get hasEqualPageSizes() {
|
get hasEqualPageSizes() {
|
||||||
let firstPageView = this._pages[0];
|
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() {
|
get scrollMode() {
|
||||||
return this._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() {
|
get spreadMode() {
|
||||||
return this._spreadMode;
|
return this._spreadMode;
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
class IPDFLinkService {
|
class IPDFLinkService {
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get pagesCount() {}
|
get pagesCount() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get page() {}
|
get page() {}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ class IPDFLinkService {
|
|||||||
set page(value) {}
|
set page(value) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get rotation() {}
|
get rotation() {}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class IPDFLinkService {
|
|||||||
set rotation(value) {}
|
set rotation(value) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get externalLinkEnabled() {}
|
get externalLinkEnabled() {}
|
||||||
|
|
||||||
@ -117,12 +117,12 @@ class IPDFHistory {
|
|||||||
*/
|
*/
|
||||||
class IRenderableView {
|
class IRenderableView {
|
||||||
/**
|
/**
|
||||||
* @returns {string} - Unique ID for rendering queue.
|
* @type {string} - Unique ID for rendering queue.
|
||||||
*/
|
*/
|
||||||
get renderingId() {}
|
get renderingId() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {RenderingStates}
|
* @type {RenderingStates}
|
||||||
*/
|
*/
|
||||||
get renderingState() {}
|
get renderingState() {}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class PDFCursorTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number} One of the values in {CursorTool}.
|
* @type {number} One of the values in {CursorTool}.
|
||||||
*/
|
*/
|
||||||
get activeTool() {
|
get activeTool() {
|
||||||
return this.active;
|
return this.active;
|
||||||
|
@ -223,7 +223,7 @@ class PDFFindController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string} The (current) normalized search query.
|
* @type {string} The (current) normalized search query.
|
||||||
*/
|
*/
|
||||||
get _query() {
|
get _query() {
|
||||||
if (this._state.query !== this._rawQuery) {
|
if (this._state.query !== this._rawQuery) {
|
||||||
|
@ -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.
|
* browser history, useful e.g. for skipping the next 'hashchange' event.
|
||||||
*/
|
*/
|
||||||
get popStateInProgress() {
|
get popStateInProgress() {
|
||||||
|
@ -64,14 +64,14 @@ class PDFLinkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get pagesCount() {
|
get pagesCount() {
|
||||||
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get page() {
|
get page() {
|
||||||
return this.pdfViewer.currentPageNumber;
|
return this.pdfViewer.currentPageNumber;
|
||||||
@ -85,7 +85,7 @@ class PDFLinkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get rotation() {
|
get rotation() {
|
||||||
return this.pdfViewer.pagesRotation;
|
return this.pdfViewer.pagesRotation;
|
||||||
@ -428,14 +428,14 @@ class SimpleLinkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get pagesCount() {
|
get pagesCount() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get page() {
|
get page() {
|
||||||
return 0;
|
return 0;
|
||||||
@ -447,7 +447,7 @@ class SimpleLinkService {
|
|||||||
set page(value) {}
|
set page(value) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get rotation() {
|
get rotation() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -109,7 +109,7 @@ class PDFSidebar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {number} One of the values in {SidebarView}.
|
* @type {number} One of the values in {SidebarView}.
|
||||||
*/
|
*/
|
||||||
get visibleView() {
|
get visibleView() {
|
||||||
return (this.isOpen ? this.active : SidebarView.NONE);
|
return (this.isOpen ? this.active : SidebarView.NONE);
|
||||||
|
@ -65,7 +65,7 @@ class PDFSidebarResizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get outerContainerWidth() {
|
get outerContainerWidth() {
|
||||||
if (!this._outerContainerWidth) {
|
if (!this._outerContainerWidth) {
|
||||||
|
@ -132,7 +132,7 @@ class SecondaryToolbar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get isOpen() {
|
get isOpen() {
|
||||||
return this.opened;
|
return this.opened;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user