Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of smaller JSDocs tweaks in src/display/api.js #13638

Merged
merged 2 commits into from
Jun 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
* } TypedArray
*/

/**
* @typedef {Object} RefProxy
* @property {number} num
* @property {number} gen
*/

/**
* Document initialization / loading parameters object.
*
Expand Down Expand Up @@ -508,6 +514,12 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
});
}

/**
* @typedef {Object} OnProgressParameters
* @property {number} loaded - Currently loaded number of bytes.
* @property {number} total - Total number of bytes in the PDF file.
*/

/**
* The loading task controls the operations required to load a PDF document
* (such as network requests) and provides a way to listen for completion,
Expand All @@ -522,8 +534,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
* {@link PasswordResponses}).
* @property {function} [onProgress] - Callback to be able to monitor the
* loading progress of the PDF file (necessary to implement e.g. a loading
* bar). The callback receives an {Object} with the properties `loaded`
* ({number}) and `total` ({number}) that indicate how many bytes are loaded.
* bar). The callback receives an {@link OnProgressParameters} argument.
* @property {function} [onUnsupportedFeature] - Callback for when an
* unsupported feature is used in the PDF document. The callback receives an
* {@link UNSUPPORTED_FEATURES} argument.
Expand Down Expand Up @@ -575,9 +586,8 @@ const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {

/**
* Callback to be able to monitor the loading progress of the PDF file
* (necessary to implement e.g. a loading bar). The callback receives
* an {Object} with the properties `loaded` ({number}) and `total`
* ({number}) that indicate how many bytes are loaded.
* (necessary to implement e.g. a loading bar).
* The callback receives an {@link OnProgressParameters} argument.
* @type {function}
*/
this.onProgress = null;
Expand Down Expand Up @@ -761,12 +771,6 @@ class PDFDocumentProxy {
return this._transport.getPage(pageNumber);
}

/**
* @typedef {Object} RefProxy
* @property {number} num
* @property {number} gen
*/

/**
* @param {RefProxy} ref - The page reference.
* @returns {Promise<number>} A promise that is resolved with the page index,
Expand Down Expand Up @@ -1231,8 +1235,7 @@ class PDFPageProxy {
}

/**
* @type {Object} The reference that points to this page. It has `num` and
* `gen` properties.
* @type {RefProxy | null} The reference that points to this page.
*/
get ref() {
return this._pageInfo.ref;
Expand Down