Merge pull request #11235 from timvandermeij/jsdoc

Improve the JSDoc comments
This commit is contained in:
Tim van der Meij 2019-10-13 21:28:18 +02:00 committed by GitHub
commit 16ae7c6960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 315 additions and 319 deletions

View File

@ -36,7 +36,7 @@ limitations under the License.
/** /**
* @param {string} url The URL prefixed with chrome-extension://.../ * @param {string} url The URL prefixed with chrome-extension://.../
* @return {string|undefined} The percent-encoded URL of the (PDF) file. * @returns {string|undefined} The percent-encoded URL of the (PDF) file.
*/ */
function parseExtensionURL(url) { function parseExtensionURL(url) {
url = url.substring(CRX_BASE_URL.length); url = url.substring(CRX_BASE_URL.length);

View File

@ -28,7 +28,7 @@ limitations under the License.
/** /**
* Invoked when "Open with PDF Viewer" is chosen in the File browser. * Invoked when "Open with PDF Viewer" is chosen in the File browser.
* *
* @param {String} id File browser action ID as specified in * @param {string} id File browser action ID as specified in
* manifest.json * manifest.json
* @param {Object} details Object of type FileHandlerExecuteEventDetails * @param {Object} details Object of type FileHandlerExecuteEventDetails
*/ */

View File

@ -26,7 +26,7 @@ function getViewerURL(pdf_url) {
/** /**
* @param {Object} details First argument of the webRequest.onHeadersReceived * @param {Object} details First argument of the webRequest.onHeadersReceived
* event. The property "url" is read. * event. The property "url" is read.
* @return {boolean} True if the PDF file should be downloaded. * @returns {boolean} True if the PDF file should be downloaded.
*/ */
function isPdfDownloadable(details) { function isPdfDownloadable(details) {
if (details.url.includes('pdfjs.action=download')) { if (details.url.includes('pdfjs.action=download')) {
@ -50,7 +50,7 @@ function isPdfDownloadable(details) {
/** /**
* Get the header from the list of headers for a given name. * Get the header from the list of headers for a given name.
* @param {Array} headers responseHeaders of webRequest.onHeadersReceived * @param {Array} headers responseHeaders of webRequest.onHeadersReceived
* @return {undefined|{name: string, value: string}} The header, if found. * @returns {undefined|{name: string, value: string}} The header, if found.
*/ */
function getHeaderFromHeaders(headers, headerName) { function getHeaderFromHeaders(headers, headerName) {
for (var i = 0; i < headers.length; ++i) { for (var i = 0; i < headers.length; ++i) {
@ -67,7 +67,7 @@ function getHeaderFromHeaders(headers, headerName) {
* @param {Object} details First argument of the webRequest.onHeadersReceived * @param {Object} details First argument of the webRequest.onHeadersReceived
* event. The properties "responseHeaders" and "url" * event. The properties "responseHeaders" and "url"
* are read. * are read.
* @return {boolean} True if the resource is a PDF file. * @returns {boolean} True if the resource is a PDF file.
*/ */
function isPdfFile(details) { function isPdfFile(details) {
var header = getHeaderFromHeaders(details.responseHeaders, 'content-type'); var header = getHeaderFromHeaders(details.responseHeaders, 'content-type');
@ -95,9 +95,9 @@ function isPdfFile(details) {
* @param {Object} details First argument of the webRequest.onHeadersReceived * @param {Object} details First argument of the webRequest.onHeadersReceived
* event. The property "responseHeaders" is read and * event. The property "responseHeaders" is read and
* modified if needed. * modified if needed.
* @return {Object|undefined} The return value for the onHeadersReceived event. * @returns {Object|undefined} The return value for the onHeadersReceived event.
* Object with key "responseHeaders" if the headers * Object with key "responseHeaders" if the headers
* have been modified, undefined otherwise. * have been modified, undefined otherwise.
*/ */
function getHeadersWithContentDispositionAttachment(details) { function getHeadersWithContentDispositionAttachment(details) {
var headers = details.responseHeaders; var headers = details.responseHeaders;

View File

@ -959,7 +959,6 @@ gulp.task('jsdoc', function (done) {
var JSDOC_FILES = [ var JSDOC_FILES = [
'src/doc_helper.js', 'src/doc_helper.js',
'src/display/api.js', 'src/display/api.js',
'src/shared/util.js',
]; ];
rimraf(JSDOC_BUILD_DIR, function () { rimraf(JSDOC_BUILD_DIR, function () {

View File

@ -36,7 +36,8 @@ class AnnotationFactory {
* @param {Object} ref * @param {Object} ref
* @param {PDFManager} pdfManager * @param {PDFManager} pdfManager
* @param {Object} idFactory * @param {Object} idFactory
* @return {Promise} A promise that is resolved with an {Annotation} instance. * @returns {Promise} A promise that is resolved with an {Annotation}
* instance.
*/ */
static create(xref, ref, pdfManager, idFactory) { static create(xref, ref, pdfManager, idFactory) {
return pdfManager.ensure(this, '_create', return pdfManager.ensure(this, '_create',
@ -253,7 +254,7 @@ class Annotation {
} }
/** /**
* @return {boolean} * @type {boolean}
*/ */
get viewable() { get viewable() {
if (this.flags === 0) { if (this.flags === 0) {
@ -263,7 +264,7 @@ class Annotation {
} }
/** /**
* @return {boolean} * @type {boolean}
*/ */
get printable() { get printable() {
if (this.flags === 0) { if (this.flags === 0) {
@ -318,7 +319,7 @@ class Annotation {
* @memberof Annotation * @memberof Annotation
* @param {number} flag - Hexadecimal representation for an annotation * @param {number} flag - Hexadecimal representation for an annotation
* characteristic * characteristic
* @return {boolean} * @returns {boolean}
* @see {@link shared/util.js} * @see {@link shared/util.js}
*/ */
hasFlag(flag) { hasFlag(flag) {
@ -530,7 +531,7 @@ class AnnotationBorderStyle {
* *
* @public * @public
* @memberof AnnotationBorderStyle * @memberof AnnotationBorderStyle
* @param {integer} width - The width. * @param {number} width - The width.
* @param {Array} rect - The annotation `Rect` entry. * @param {Array} rect - The annotation `Rect` entry.
*/ */
setWidth(width, rect = [0, 0, 0, 0]) { setWidth(width, rect = [0, 0, 0, 0]) {
@ -642,7 +643,7 @@ class AnnotationBorderStyle {
* *
* @public * @public
* @memberof AnnotationBorderStyle * @memberof AnnotationBorderStyle
* @param {integer} radius - The horizontal corner radius * @param {number} radius - The horizontal corner radius.
*/ */
setHorizontalCornerRadius(radius) { setHorizontalCornerRadius(radius) {
if (Number.isInteger(radius)) { if (Number.isInteger(radius)) {
@ -655,7 +656,7 @@ class AnnotationBorderStyle {
* *
* @public * @public
* @memberof AnnotationBorderStyle * @memberof AnnotationBorderStyle
* @param {integer} radius - The vertical corner radius * @param {number} radius - The vertical corner radius.
*/ */
setVerticalCornerRadius(radius) { setVerticalCornerRadius(radius) {
if (Number.isInteger(radius)) { if (Number.isInteger(radius)) {
@ -780,7 +781,7 @@ class WidgetAnnotation extends Annotation {
* @private * @private
* @memberof WidgetAnnotation * @memberof WidgetAnnotation
* @param {Dict} dict - Complete widget annotation dictionary * @param {Dict} dict - Complete widget annotation dictionary
* @return {string} * @returns {string}
*/ */
_constructFieldName(dict) { _constructFieldName(dict) {
// Both the `Parent` and `T` fields are optional. While at least one of // Both the `Parent` and `T` fields are optional. While at least one of
@ -826,7 +827,7 @@ class WidgetAnnotation extends Annotation {
* @memberof WidgetAnnotation * @memberof WidgetAnnotation
* @param {number} flag - Hexadecimal representation for an annotation * @param {number} flag - Hexadecimal representation for an annotation
* field characteristic * field characteristic
* @return {boolean} * @returns {boolean}
* @see {@link shared/util.js} * @see {@link shared/util.js}
*/ */
hasFieldFlag(flag) { hasFieldFlag(flag) {

View File

@ -458,7 +458,7 @@ let CCITTFaxDecoder = (function CCITTFaxDecoder() {
/** /**
* @param {CCITTFaxDecoderSource} source - The data which should be decoded. * @param {CCITTFaxDecoderSource} source - The data which should be decoded.
* @param {Object} options - (optional) Decoding options. * @param {Object} [options] - Decoding options.
*/ */
function CCITTFaxDecoder(source, options = {}) { function CCITTFaxDecoder(source, options = {}) {
if (!source || typeof source.next !== 'function') { if (!source || typeof source.next !== 'function') {

View File

@ -22,11 +22,11 @@ import { isDict, isName, isStream } from './primitives';
* Resizes an RGB image with 3 components. * Resizes an RGB image with 3 components.
* @param {TypedArray} src - The source buffer. * @param {TypedArray} src - The source buffer.
* @param {TypedArray} dest - The destination buffer. * @param {TypedArray} dest - The destination buffer.
* @param {Number} w1 - Original width. * @param {number} w1 - Original width.
* @param {Number} h1 - Original height. * @param {number} h1 - Original height.
* @param {Number} w2 - New width. * @param {number} w2 - New width.
* @param {Number} h2 - New height. * @param {number} h2 - New height.
* @param {Number} alpha01 - Size reserved for the alpha channel. * @param {number} alpha01 - Size reserved for the alpha channel.
*/ */
function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
const COMPONENTS = 3; const COMPONENTS = 3;
@ -390,7 +390,7 @@ class ColorSpace {
* This does not handle Lab, Indexed, or Pattern decode maps since they are * This does not handle Lab, Indexed, or Pattern decode maps since they are
* slightly different. * slightly different.
* @param {Array} decode - Decode map (usually from an image). * @param {Array} decode - Decode map (usually from an image).
* @param {Number} numComps - Number of components the color space has. * @param {number} numComps - Number of components the color space has.
*/ */
static isDefaultDecode(decode, numComps) { static isDefaultDecode(decode, numComps) {
if (!Array.isArray(decode)) { if (!Array.isArray(decode)) {

View File

@ -95,10 +95,10 @@ const ROMAN_NUMBER_MAP = [
/** /**
* Converts positive integers to (upper case) Roman numerals. * Converts positive integers to (upper case) Roman numerals.
* @param {integer} number - The number that should be converted. * @param {number} number - The number that should be converted.
* @param {boolean} lowerCase - Indicates if the result should be converted * @param {boolean} lowerCase - Indicates if the result should be converted
* to lower case letters. The default value is `false`. * to lower case letters. The default value is `false`.
* @return {string} The resulting Roman number. * @returns {string} The resulting Roman number.
*/ */
function toRomanNumerals(number, lowerCase = false) { function toRomanNumerals(number, lowerCase = false) {
assert(Number.isInteger(number) && number > 0, assert(Number.isInteger(number) && number > 0,

View File

@ -2095,7 +2095,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
/** /**
* Builds a char code to unicode map based on section 9.10 of the spec. * Builds a char code to unicode map based on section 9.10 of the spec.
* @param {Object} properties Font properties object. * @param {Object} properties Font properties object.
* @return {Promise} A Promise that is resolved with a * @returns {Promise} A Promise that is resolved with a
* {ToUnicodeMap|IdentityToUnicodeMap} object. * {ToUnicodeMap|IdentityToUnicodeMap} object.
*/ */
buildToUnicode(properties) { buildToUnicode(properties) {

View File

@ -732,7 +732,7 @@ var Font = (function FontClosure() {
* private use area. This is done to avoid issues with various problematic * private use area. This is done to avoid issues with various problematic
* unicode areas where either a glyph won't be drawn or is deformed by a * unicode areas where either a glyph won't be drawn or is deformed by a
* shaper. * shaper.
* @return {Object} Two properties: * @returns {Object} Two properties:
* 'toFontChar' - maps original char codes(the value that will be read * 'toFontChar' - maps original char codes(the value that will be read
* from commands such as show text) to the char codes that will be used in the * from commands such as show text) to the char codes that will be used in the
* font that we build * font that we build

View File

@ -49,11 +49,11 @@ var PDFImage = (function PDFImageClosure() {
/** /**
* Resizes an image mask with 1 component. * Resizes an image mask with 1 component.
* @param {TypedArray} src - The source buffer. * @param {TypedArray} src - The source buffer.
* @param {Number} bpc - Number of bits per component. * @param {number} bpc - Number of bits per component.
* @param {Number} w1 - Original width. * @param {number} w1 - Original width.
* @param {Number} h1 - Original height. * @param {number} h1 - Original height.
* @param {Number} w2 - New width. * @param {number} w2 - New width.
* @param {Number} h2 - New height. * @param {number} h2 - New height.
* @returns {TypedArray} The resized image mask buffer. * @returns {TypedArray} The resized image mask buffer.
*/ */
function resizeImageMask(src, bpc, w1, h1, w2, h2) { function resizeImageMask(src, bpc, w1, h1, w2, h2) {

View File

@ -863,8 +863,8 @@ class Catalog {
* @property {Dict} destDict - The dictionary containing the destination. * @property {Dict} destDict - The dictionary containing the destination.
* @property {Object} resultObj - The object where the parsed destination * @property {Object} resultObj - The object where the parsed destination
* properties will be placed. * properties will be placed.
* @property {string} docBaseUrl - (optional) The document base URL that is * @property {string} [docBaseUrl] - The document base URL that is used when
* used when attempting to recover valid absolute URLs from relative ones. * attempting to recover valid absolute URLs from relative ones.
*/ */
/** /**

View File

@ -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);

View File

@ -31,8 +31,8 @@ import {
* @property {PageViewport} viewport * @property {PageViewport} viewport
* @property {IPDFLinkService} linkService * @property {IPDFLinkService} linkService
* @property {DownloadManager} downloadManager * @property {DownloadManager} downloadManager
* @property {string} imageResourcesPath - (optional) Path for image resources, * @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms * @property {boolean} renderInteractiveForms
* @property {Object} svgFactory * @property {Object} svgFactory
*/ */
@ -1328,8 +1328,8 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
* @property {PDFPage} page * @property {PDFPage} page
* @property {IPDFLinkService} linkService * @property {IPDFLinkService} linkService
* @property {DownloadManager} downloadManager * @property {DownloadManager} downloadManager
* @property {string} imageResourcesPath - (optional) Path for image resources, * @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms * @property {boolean} renderInteractiveForms
*/ */

View File

@ -15,6 +15,10 @@
/* globals requirejs, __non_webpack_require__ */ /* globals requirejs, __non_webpack_require__ */
/* eslint no-var: error */ /* eslint no-var: error */
/**
* @module pdfjsLib
*/
import { import {
AbortException, assert, createPromiseCapability, getVerbosityLevel, info, AbortException, assert, createPromiseCapability, getVerbosityLevel, info,
InvalidPDFException, isArrayBuffer, isSameOrigin, MissingPDFException, InvalidPDFException, isArrayBuffer, isSameOrigin, MissingPDFException,
@ -105,7 +109,7 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('GENERIC')) {
* @typedef {function} IPDFStreamFactory * @typedef {function} IPDFStreamFactory
* @param {DocumentInitParameters} params The document initialization * @param {DocumentInitParameters} params The document initialization
* parameters. The "url" key is always present. * parameters. The "url" key is always present.
* @return {IPDFStream} * @returns {IPDFStream}
*/ */
/** @type IPDFStreamFactory */ /** @type IPDFStreamFactory */
@ -217,8 +221,7 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
* @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src
* Can be a url to where a PDF is located, a typed array (Uint8Array) * Can be a url to where a PDF is located, a typed array (Uint8Array)
* already populated with data or parameter object. * already populated with data or parameter object.
* * @returns {PDFDocumentLoadingTask}
* @return {PDFDocumentLoadingTask}
*/ */
function getDocument(src) { function getDocument(src) {
const task = new PDFDocumentLoadingTask(); const task = new PDFDocumentLoadingTask();
@ -417,15 +420,14 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}); });
} }
/**
* PDF document loading operation.
* @class
* @alias PDFDocumentLoadingTask
*/
const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() { const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
let nextDocumentId = 0; let nextDocumentId = 0;
/** @constructs PDFDocumentLoadingTask */ /**
* The loading task controls the operations required to load a PDF document
* (such as network requests) and provides a way to listen for completion,
* after which individual pages can be rendered.
*/
class PDFDocumentLoadingTask { class PDFDocumentLoadingTask {
constructor() { constructor() {
this._capability = createPromiseCapability(); this._capability = createPromiseCapability();
@ -467,7 +469,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;
@ -475,8 +477,8 @@ const PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {
/** /**
* Aborts all network requests and destroys worker. * Aborts all network requests and destroys worker.
* @return {Promise} A promise that is resolved after destruction activity * @returns {Promise} A promise that is resolved after destruction activity
* is completed. * is completed.
*/ */
destroy() { destroy() {
this.destroyed = true; this.destroyed = true;
@ -591,14 +593,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;
@ -606,7 +608,7 @@ class PDFDocumentProxy {
/** /**
* @param {number} pageNumber - The page number to get. The first page is 1. * @param {number} pageNumber - The page number to get. The first page is 1.
* @return {Promise} A promise that is resolved with a {@link PDFPageProxy} * @returns {Promise} A promise that is resolved with a {@link PDFPageProxy}
* object. * object.
*/ */
getPage(pageNumber) { getPage(pageNumber) {
@ -616,7 +618,7 @@ class PDFDocumentProxy {
/** /**
* @param {{num: number, gen: number}} ref - The page reference. Must have * @param {{num: number, gen: number}} ref - The page reference. Must have
* the `num` and `gen` properties. * the `num` and `gen` properties.
* @return {Promise} A promise that is resolved with the page index that is * @returns {Promise} A promise that is resolved with the page index that is
* associated with the reference. * associated with the reference.
*/ */
getPageIndex(ref) { getPageIndex(ref) {
@ -624,7 +626,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with a lookup table for * @returns {Promise} A promise that is resolved with a lookup table for
* mapping named destinations to reference numbers. * mapping named destinations to reference numbers.
* *
* This can be slow for large documents. Use `getDestination` instead. * This can be slow for large documents. Use `getDestination` instead.
@ -635,7 +637,7 @@ class PDFDocumentProxy {
/** /**
* @param {string} id - The named destination to get. * @param {string} id - The named destination to get.
* @return {Promise} A promise that is resolved with all information * @returns {Promise} A promise that is resolved with all information
* of the given named destination. * of the given named destination.
*/ */
getDestination(id) { getDestination(id) {
@ -643,7 +645,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Array} containing * @returns {Promise} A promise that is resolved with an {Array} containing
* the page labels that correspond to the page indexes, or `null` when * the page labels that correspond to the page indexes, or `null` when
* no page labels are present in the PDF file. * no page labels are present in the PDF file.
*/ */
@ -652,7 +654,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with a {string} containing * @returns {Promise} A promise that is resolved with a {string} containing
* the page layout name. * the page layout name.
*/ */
getPageLayout() { getPageLayout() {
@ -660,7 +662,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with a {string} containing * @returns {Promise} A promise that is resolved with a {string} containing
* the page mode name. * the page mode name.
*/ */
getPageMode() { getPageMode() {
@ -668,7 +670,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Object} containing * @returns {Promise} A promise that is resolved with an {Object} containing
* the viewer preferences. * the viewer preferences.
*/ */
getViewerPreferences() { getViewerPreferences() {
@ -676,15 +678,15 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Array} containing the * @returns {Promise} A promise that is resolved with an {Array} containing
* destination, or `null` when no open action is present in the PDF file. * the destination, or `null` when no open action is present in the PDF.
*/ */
getOpenActionDestination() { getOpenActionDestination() {
return this._transport.getOpenActionDestination(); return this._transport.getOpenActionDestination();
} }
/** /**
* @return {Promise} A promise that is resolved with a lookup table for * @returns {Promise} A promise that is resolved with a lookup table for
* mapping named attachments to their content. * mapping named attachments to their content.
*/ */
getAttachments() { getAttachments() {
@ -692,7 +694,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Array} of all the * @returns {Promise} A promise that is resolved with an {Array} of all the
* JavaScript strings in the name tree, or `null` if no JavaScript exists. * JavaScript strings in the name tree, or `null` if no JavaScript exists.
*/ */
getJavaScript() { getJavaScript() {
@ -700,7 +702,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Array} that is a * @returns {Promise} A promise that is resolved with an {Array} that is a
* tree outline (if it has one) of the PDF. The tree is in the format of: * tree outline (if it has one) of the PDF. The tree is in the format of:
* [ * [
* { * {
@ -721,7 +723,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Array} that contains * @returns {Promise} A promise that is resolved with an {Array} that contains
* the permission flags for the PDF document, or `null` when * the permission flags for the PDF document, or `null` when
* no permissions are present in the PDF file. * no permissions are present in the PDF file.
*/ */
@ -730,7 +732,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with an {Object} that has * @returns {Promise} A promise that is resolved with an {Object} that has
* `info` and `metadata` properties. `info` is an {Object} filled with * `info` and `metadata` properties. `info` is an {Object} filled with
* anything available in the information dictionary and similarly * anything available in the information dictionary and similarly
* `metadata` is a {Metadata} object with information from the metadata * `metadata` is a {Metadata} object with information from the metadata
@ -741,15 +743,15 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise that is resolved with a {TypedArray} that has * @returns {Promise} A promise that is resolved with a {TypedArray} that has
* the raw data from the PDF. * the raw data from the PDF.
*/ */
getData() { getData() {
return this._transport.getData(); return this._transport.getData();
} }
/** /**
* @return {Promise} A promise that is resolved when the document's data * @returns {Promise} A promise that is resolved when the document's data
* is loaded. It is resolved with an {Object} that contains the `length` * is loaded. It is resolved with an {Object} that contains the `length`
* property that indicates size of the PDF data in bytes. * property that indicates size of the PDF data in bytes.
*/ */
@ -758,7 +760,7 @@ class PDFDocumentProxy {
} }
/** /**
* @return {Promise} A promise this is resolved with current statistics about * @returns {Promise} A promise this is resolved with current statistics about
* document structures (see {@link PDFDocumentStats}). * document structures (see {@link PDFDocumentStats}).
*/ */
getStats() { getStats() {
@ -780,16 +782,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 +917,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;
@ -953,7 +955,7 @@ class PDFPageProxy {
/** /**
* @param {GetViewportParameters} params - Viewport parameters. * @param {GetViewportParameters} params - Viewport parameters.
* @return {PageViewport} Contains 'width' and 'height' properties * @returns {PageViewport} Contains 'width' and 'height' properties
* along with transforms required for rendering. * along with transforms required for rendering.
*/ */
getViewport({ scale, rotation = this.rotate, dontFlip = false, } = {}) { getViewport({ scale, rotation = this.rotate, dontFlip = false, } = {}) {
@ -972,8 +974,8 @@ class PDFPageProxy {
/** /**
* @param {GetAnnotationsParameters} params - Annotation parameters. * @param {GetAnnotationsParameters} params - Annotation parameters.
* @return {Promise} A promise that is resolved with an {Array} of the * @returns {Promise} A promise that is resolved with an {Array} of the
* annotation objects. * annotation objects.
*/ */
getAnnotations({ intent = null, } = {}) { getAnnotations({ intent = null, } = {}) {
if (!this.annotationsPromise || this.annotationsIntent !== intent) { if (!this.annotationsPromise || this.annotationsIntent !== intent) {
@ -987,8 +989,8 @@ class PDFPageProxy {
/** /**
* Begins the process of rendering a page to the desired context. * Begins the process of rendering a page to the desired context.
* @param {RenderParameters} params Page render parameters. * @param {RenderParameters} params Page render parameters.
* @return {RenderTask} An object that contains the promise, which * @returns {RenderTask} An object that contains the promise, which
* is resolved when the page finishes rendering. * is resolved when the page finishes rendering.
*/ */
render({ canvasContext, viewport, intent = 'display', enableWebGL = false, render({ canvasContext, viewport, intent = 'display', enableWebGL = false,
renderInteractiveForms = false, transform = null, imageLayer = null, renderInteractiveForms = false, transform = null, imageLayer = null,
@ -1101,7 +1103,7 @@ class PDFPageProxy {
} }
/** /**
* @return {Promise} A promise resolved with an {@link PDFOperatorList} * @returns {Promise} A promise resolved with an {@link PDFOperatorList}
* object that represents page's operator list. * object that represents page's operator list.
*/ */
getOperatorList() { getOperatorList() {
@ -1146,7 +1148,7 @@ class PDFPageProxy {
/** /**
* @param {getTextContentParameters} params - getTextContent parameters. * @param {getTextContentParameters} params - getTextContent parameters.
* @return {ReadableStream} ReadableStream to read textContent chunks. * @returns {ReadableStream} ReadableStream to read textContent chunks.
*/ */
streamTextContent({ normalizeWhitespace = false, streamTextContent({ normalizeWhitespace = false,
disableCombineTextItems = false, } = {}) { disableCombineTextItems = false, } = {}) {
@ -1166,8 +1168,8 @@ class PDFPageProxy {
/** /**
* @param {getTextContentParameters} params - getTextContent parameters. * @param {getTextContentParameters} params - getTextContent parameters.
* @return {Promise} That is resolved a {@link TextContent} * @returns {Promise} That is resolved a {@link TextContent}
* object that represent the page text content. * object that represent the page text content.
*/ */
getTextContent(params = {}) { getTextContent(params = {}) {
const readableStream = this.streamTextContent(params); const readableStream = this.streamTextContent(params);
@ -1195,7 +1197,8 @@ class PDFPageProxy {
} }
/** /**
* Destroys page object. * Destroys the page object.
* @private
*/ */
_destroy() { _destroy() {
this.destroyed = true; this.destroyed = true;
@ -1238,9 +1241,8 @@ class PDFPageProxy {
} }
/** /**
* For internal use only. Attempts to clean up if rendering is in a state * Attempts to clean up if rendering is in a state where that's possible.
* where that's possible. * @private
* @ignore
*/ */
_tryCleanup(resetStats = false) { _tryCleanup(resetStats = false) {
if (!this.pendingCleanup || if (!this.pendingCleanup ||
@ -1264,8 +1266,7 @@ class PDFPageProxy {
} }
/** /**
* For internal use only. * @private
* @ignore
*/ */
_startRenderPage(transparency, intent) { _startRenderPage(transparency, intent) {
const intentState = this.intentStates[intent]; const intentState = this.intentStates[intent];
@ -1281,8 +1282,7 @@ class PDFPageProxy {
} }
/** /**
* For internal use only. * @private
* @ignore
*/ */
_renderPageChunk(operatorListChunk, intentState) { _renderPageChunk(operatorListChunk, intentState) {
// Add the new chunk to the current operator list. // Add the new chunk to the current operator list.
@ -1304,8 +1304,7 @@ class PDFPageProxy {
} }
/** /**
* For internal use only. * @private
* @ignore
*/ */
_pumpOperatorList(args) { _pumpOperatorList(args) {
assert(args.intent, assert(args.intent,
@ -1358,8 +1357,7 @@ class PDFPageProxy {
} }
/** /**
* For internal use only. * @private
* @ignore
*/ */
_abortOperatorList({ intentState, reason, force = false, }) { _abortOperatorList({ intentState, reason, force = false, }) {
assert(reason instanceof Error, assert(reason instanceof Error,
@ -1406,7 +1404,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);
@ -1508,12 +1506,6 @@ class LoopbackPort {
* constants from {VerbosityLevel} should be used. * constants from {VerbosityLevel} should be used.
*/ */
/**
* PDF.js web worker abstraction, it controls instantiation of PDF documents and
* WorkerTransport for them. If creation of a web worker is not possible,
* a "fake" worker will be used instead.
* @class
*/
const PDFWorker = (function PDFWorkerClosure() { const PDFWorker = (function PDFWorkerClosure() {
const pdfWorkerPorts = new WeakMap(); const pdfWorkerPorts = new WeakMap();
let nextFakeWorkerId = 0; let nextFakeWorkerId = 0;
@ -1591,9 +1583,15 @@ const PDFWorker = (function PDFWorkerClosure() {
} }
/** /**
* @param {PDFWorkerParameters} params - The worker initialization parameters. * PDF.js web worker abstraction, which controls the instantiation of PDF
* documents. Message handlers are used to pass information from the main
* thread to the worker thread and vice versa. If the creation of a web
* worker is not possible, a "fake" worker will be used instead.
*/ */
class PDFWorker { class PDFWorker {
/**
* @param {PDFWorkerParameters} params - Worker initialization parameters.
*/
constructor({ name = null, port = null, constructor({ name = null, port = null,
verbosity = getVerbosityLevel(), } = {}) { verbosity = getVerbosityLevel(), } = {}) {
if (port && pdfWorkerPorts.has(port)) { if (port && pdfWorkerPorts.has(port)) {
@ -2521,7 +2519,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;

View File

@ -25,7 +25,7 @@
* Extract file name from the Content-Disposition HTTP response header. * Extract file name from the Content-Disposition HTTP response header.
* *
* @param {string} contentDisposition * @param {string} contentDisposition
* @return {string} Filename, if found in the Content-Disposition header. * @returns {string} Filename, if found in the Content-Disposition header.
*/ */
function getFilenameFromContentDispositionHeader(contentDisposition) { function getFilenameFromContentDispositionHeader(contentDisposition) {
let needsEncodingFixup = true; let needsEncodingFixup = true;

View File

@ -160,22 +160,22 @@ class DOMSVGFactory {
* @property {Array} viewBox - The xMin, yMin, xMax and yMax coordinates. * @property {Array} viewBox - The xMin, yMin, xMax and yMax coordinates.
* @property {number} scale - The scale of the viewport. * @property {number} scale - The scale of the viewport.
* @property {number} rotation - The rotation, in degrees, of the viewport. * @property {number} rotation - The rotation, in degrees, of the viewport.
* @property {number} offsetX - (optional) The horizontal, i.e. x-axis, offset. * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
* The default value is `0`. * default value is `0`.
* @property {number} offsetY - (optional) The vertical, i.e. y-axis, offset. * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The
* The default value is `0`. * default value is `0`.
* @property {boolean} dontFlip - (optional) If true, the y-axis will not be * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.
* flipped. The default value is `false`. * The default value is `false`.
*/ */
/** /**
* @typedef {Object} PageViewportCloneParameters * @typedef {Object} PageViewportCloneParameters
* @property {number} scale - (optional) The scale, overriding the one in the * @property {number} [scale] - The scale, overriding the one in the cloned
* cloned viewport. The default value is `this.scale`. * viewport. The default value is `this.scale`.
* @property {number} rotation - (optional) The rotation, in degrees, overriding * @property {number} [rotation] - The rotation, in degrees, overriding the one
* the one in the cloned viewport. The default value is `this.rotation`. * in the cloned viewport. The default value is `this.rotation`.
* @property {boolean} dontFlip - (optional) If true, the x-axis will not be * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.
* flipped. The default value is `false`. * The default value is `false`.
*/ */
/** /**
@ -251,8 +251,8 @@ class PageViewport {
/** /**
* Clones viewport, with optional additional properties. * Clones viewport, with optional additional properties.
* @param {PageViewportCloneParameters} - (optional) * @param {PageViewportCloneParameters} [params]
* @return {PageViewport} Cloned viewport. * @returns {PageViewport} Cloned viewport.
*/ */
clone({ scale = this.scale, rotation = this.rotation, clone({ scale = this.scale, rotation = this.rotation,
dontFlip = false, } = {}) { dontFlip = false, } = {}) {
@ -271,7 +271,7 @@ class PageViewport {
* converting PDF location into canvas pixel coordinates. * converting PDF location into canvas pixel coordinates.
* @param {number} x - The x-coordinate. * @param {number} x - The x-coordinate.
* @param {number} y - The y-coordinate. * @param {number} y - The y-coordinate.
* @return {Object} Object containing `x` and `y` properties of the * @returns {Object} Object containing `x` and `y` properties of the
* point in the viewport coordinate space. * point in the viewport coordinate space.
* @see {@link convertToPdfPoint} * @see {@link convertToPdfPoint}
* @see {@link convertToViewportRectangle} * @see {@link convertToViewportRectangle}
@ -283,8 +283,8 @@ class PageViewport {
/** /**
* Converts PDF rectangle to the viewport coordinates. * Converts PDF rectangle to the viewport coordinates.
* @param {Array} rect - The xMin, yMin, xMax and yMax coordinates. * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.
* @return {Array} Array containing corresponding coordinates of the rectangle * @returns {Array} Array containing corresponding coordinates of the
* in the viewport coordinate space. * rectangle in the viewport coordinate space.
* @see {@link convertToViewportPoint} * @see {@link convertToViewportPoint}
*/ */
convertToViewportRectangle(rect) { convertToViewportRectangle(rect) {
@ -298,7 +298,7 @@ class PageViewport {
* for converting canvas pixel location into PDF one. * for converting canvas pixel location into PDF one.
* @param {number} x - The x-coordinate. * @param {number} x - The x-coordinate.
* @param {number} y - The y-coordinate. * @param {number} y - The y-coordinate.
* @return {Object} Object containing `x` and `y` properties of the * @returns {Object} Object containing `x` and `y` properties of the
* point in the PDF coordinate space. * point in the PDF coordinate space.
* @see {@link convertToViewportPoint} * @see {@link convertToViewportPoint}
*/ */
@ -334,12 +334,12 @@ const LinkTargetStringMap = [
* @typedef ExternalLinkParameters * @typedef ExternalLinkParameters
* @typedef {Object} ExternalLinkParameters * @typedef {Object} ExternalLinkParameters
* @property {string} url - An absolute URL. * @property {string} url - An absolute URL.
* @property {LinkTarget} target - (optional) The link target. * @property {LinkTarget} [target] - The link target. The default value is
* The default value is `LinkTarget.NONE`. * `LinkTarget.NONE`.
* @property {string} rel - (optional) The link relationship. * @property {string} [rel] - The link relationship. The default value is
* The default value is `DEFAULT_LINK_REL`. * `DEFAULT_LINK_REL`.
* @property {boolean} enabled - (optional) Whether the link should be enabled. * @property {boolean} [enabled] - Whether the link should be enabled. The
* The default value is true. * default value is true.
*/ */
/** /**
@ -514,7 +514,7 @@ class PDFDateString {
* parts of the date string). * parts of the date string).
* *
* @param {string} input * @param {string} input
* @return {Date|null} * @returns {Date|null}
*/ */
static toDateObject(input) { static toDateObject(input) {
if (!input || !isString(input)) { if (!input || !isString(input)) {

View File

@ -20,24 +20,23 @@ import globalScope from '../shared/global_scope';
* Text layer render parameters. * Text layer render parameters.
* *
* @typedef {Object} TextLayerRenderParameters * @typedef {Object} TextLayerRenderParameters
* @property {TextContent} textContent - (optional) Text content to render * @property {TextContent} [textContent] - Text content to render (the object
* (the object is returned by the page's getTextContent() method). * is returned by the page's `getTextContent` method).
* @property {ReadableStream} textContentStream - (optional) Text content * @property {ReadableStream} [textContentStream] - Text content stream to
* stream to render (the stream is returned by the page's * render (the stream is returned by the page's `streamTextContent` method).
* streamTextContent() method).
* @property {HTMLElement} container - HTML element that will contain text runs. * @property {HTMLElement} container - HTML element that will contain text runs.
* @property {PageViewport} viewport - The target viewport to properly * @property {PageViewport} viewport - The target viewport to properly
* layout the text runs. * layout the text runs.
* @property {Array} textDivs - (optional) HTML elements that are correspond * @property {Array} [textDivs] - HTML elements that are correspond to the
* the text items of the textContent input. This is output and shall be * text items of the textContent input. This is output and shall be
* initially be set to empty array. * initially be set to empty array.
* @property {Array} textContentItemsStr - (optional) Strings that correspond * @property {Array} [textContentItemsStr] - Strings that correspond to the
* the `str` property of the text items of textContent input. This is output * `str` property of the text items of textContent input. This is output
* and shall be initially be set to empty array. * and shall be initially be set to empty array.
* @property {number} timeout - (optional) Delay in milliseconds before * @property {number} [timeout] - Delay in milliseconds before rendering of the
* rendering of the text runs occurs. * text runs occurs.
* @property {boolean} enhanceTextSelection - (optional) Whether to turn on the * @property {boolean} [enhanceTextSelection] - Whether to turn on the text
* text selection enhancement. * selection enhancement.
*/ */
var renderTextLayer = (function renderTextLayerClosure() { var renderTextLayer = (function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000; var MAX_TEXT_DIVS_TO_RENDER = 100000;

View File

@ -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;

View File

@ -132,9 +132,9 @@ MessageHandler.prototype = {
}, },
/** /**
* Sends a message to the comObj to invoke the action with the supplied data. * Sends a message to the comObj to invoke the action with the supplied data.
* @param {String} actionName - Action to call. * @param {string} actionName - Action to call.
* @param {JSON} data - JSON data to send. * @param {JSON} data - JSON data to send.
* @param {Array} [transfers] - Optional list of transfers/ArrayBuffers * @param {Array} [transfers] - List of transfers/ArrayBuffers.
*/ */
send(actionName, data, transfers) { send(actionName, data, transfers) {
this.postMessage({ this.postMessage({
@ -147,9 +147,9 @@ MessageHandler.prototype = {
/** /**
* Sends a message to the comObj to invoke the action with the supplied data. * Sends a message to the comObj to invoke the action with the supplied data.
* Expects that the other side will callback with the response. * Expects that the other side will callback with the response.
* @param {String} actionName - Action to call. * @param {string} actionName - Action to call.
* @param {JSON} data - JSON data to send. * @param {JSON} data - JSON data to send.
* @param {Array} [transfers] - Optional list of transfers/ArrayBuffers. * @param {Array} [transfers] - List of transfers/ArrayBuffers.
* @returns {Promise} Promise to be resolved with response data. * @returns {Promise} Promise to be resolved with response data.
*/ */
sendWithPromise(actionName, data, transfers) { sendWithPromise(actionName, data, transfers) {
@ -172,12 +172,12 @@ MessageHandler.prototype = {
/** /**
* Sends a message to the comObj to invoke the action with the supplied data. * Sends a message to the comObj to invoke the action with the supplied data.
* Expect that the other side will callback to signal 'start_complete'. * Expect that the other side will callback to signal 'start_complete'.
* @param {String} actionName - Action to call. * @param {string} actionName - Action to call.
* @param {JSON} data - JSON data to send. * @param {JSON} data - JSON data to send.
* @param {Object} queueingStrategy - strategy to signal backpressure based on * @param {Object} queueingStrategy - Strategy to signal backpressure based on
* internal queue. * internal queue.
* @param {Array} [transfers] - Optional list of transfers/ArrayBuffers. * @param {Array} [transfers] - List of transfers/ArrayBuffers.
* @return {ReadableStream} ReadableStream to read data in chunks. * @returns {ReadableStream} ReadableStream to read data in chunks.
*/ */
sendWithStream(actionName, data, queueingStrategy, transfers) { sendWithStream(actionName, data, queueingStrategy, transfers) {
let streamId = this.streamId++; let streamId = this.streamId++;

View File

@ -820,7 +820,7 @@ function isSpace(ch) {
* Creates a promise capability object. * Creates a promise capability object.
* @alias createPromiseCapability * @alias createPromiseCapability
* *
* @return {PromiseCapability} * @returns {PromiseCapability}
*/ */
function createPromiseCapability() { function createPromiseCapability() {
const capability = Object.create(null); const capability = Object.create(null);

View File

@ -21,8 +21,8 @@ import { SimpleLinkService } from './pdf_link_service';
* @typedef {Object} AnnotationLayerBuilderOptions * @typedef {Object} AnnotationLayerBuilderOptions
* @property {HTMLDivElement} pageDiv * @property {HTMLDivElement} pageDiv
* @property {PDFPage} pdfPage * @property {PDFPage} pdfPage
* @property {string} imageResourcesPath - (optional) Path for image resources, * @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms * @property {boolean} renderInteractiveForms
* @property {IPDFLinkService} linkService * @property {IPDFLinkService} linkService
* @property {DownloadManager} downloadManager * @property {DownloadManager} downloadManager
@ -109,8 +109,8 @@ class DefaultAnnotationLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage * @param {PDFPage} pdfPage
* @param {string} imageResourcesPath - (optional) Path for image resources, * @param {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderInteractiveForms * @param {boolean} renderInteractiveForms
* @param {IL10n} l10n * @param {IL10n} l10n
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}

View File

@ -609,9 +609,9 @@ let PDFViewerApplication = {
/** /**
* Opens PDF document specified by URL or array with additional arguments. * Opens PDF document specified by URL or array with additional arguments.
* @param {string|TypedArray|ArrayBuffer} file - PDF location or binary data. * @param {string|TypedArray|ArrayBuffer} file - PDF location or binary data.
* @param {Object} args - (optional) Additional arguments for the getDocument * @param {Object} [args] - Additional arguments for the getDocument call,
* call, e.g. HTTP headers ('httpHeaders') or * e.g. HTTP headers ('httpHeaders') or alternative
* alternative data transport ('range'). * data transport ('range').
* @returns {Promise} - Returns the promise, which is resolved when document * @returns {Promise} - Returns the promise, which is resolved when document
* is opened. * is opened.
*/ */
@ -764,10 +764,10 @@ let PDFViewerApplication = {
/** /**
* Show the error box. * Show the error box.
* @param {String} message A message that is human readable. * @param {string} message - A message that is human readable.
* @param {Object} moreInfo (optional) Further information about the error * @param {Object} [moreInfo] - Further information about the error that is
* that is more technical. Should have a 'message' * more technical. Should have a 'message' and
* and optionally a 'stack' property. * optionally a 'stack' property.
*/ */
error(message, moreInfo) { error(message, moreInfo) {
let moreInfoText = [this.l10n.get('error_version_info', let moreInfoText = [this.l10n.get('error_version_info',

View File

@ -33,36 +33,35 @@ const DEFAULT_CACHE_SIZE = 10;
/** /**
* @typedef {Object} PDFViewerOptions * @typedef {Object} PDFViewerOptions
* @property {HTMLDivElement} container - The container for the viewer element. * @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} viewer - (optional) The viewer element. * @property {HTMLDivElement} [viewer] - The viewer element.
* @property {EventBus} eventBus - The application event bus. * @property {EventBus} eventBus - The application event bus.
* @property {IPDFLinkService} linkService - The navigation/linking service. * @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {DownloadManager} downloadManager - (optional) The download * @property {DownloadManager} [downloadManager] - The download manager
* manager component. * component.
* @property {PDFFindController} findController - (optional) The find * @property {PDFFindController} [findController] - The find controller
* controller component. * component.
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.
* queue object. * @property {boolean} [removePageBorders] - Removes the border shadow around
* @property {boolean} removePageBorders - (optional) Removes the border shadow * the pages. The default value is `false`.
* around the pages. The default value is `false`. * @property {number} [textLayerMode] - Controls if the text layer used for
* @property {number} textLayerMode - (optional) Controls if the text layer used * selection and searching is created, and if the improved text selection
* for selection and searching is created, and if the improved text selection
* behaviour is enabled. The constants from {TextLayerMode} should be used. * behaviour is enabled. The constants from {TextLayerMode} should be used.
* The default value is `TextLayerMode.ENABLE`. * The default value is `TextLayerMode.ENABLE`.
* @property {string} imageResourcesPath - (optional) Path for image resources, * @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * mainly for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms - (optional) Enables rendering of * @property {boolean} [renderInteractiveForms] - Enables rendering of
* interactive form elements. The default is `false`. * interactive form elements. The default is `false`.
* @property {boolean} enablePrintAutoRotate - (optional) Enables automatic * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of
* rotation of pages whose orientation differ from the first page upon * pages whose orientation differ from the first page upon printing. The
* printing. The default is `false`. * default is `false`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'. * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
* @property {boolean} enableWebGL - (optional) Enables WebGL accelerated * @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
* rendering for some operations. The default value is `false`. * some operations. The default value is `false`.
* @property {boolean} useOnlyCssZoom - (optional) Enables CSS only zooming. * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default
* The default value is `false`. * value is `false`.
* @property {number} maxCanvasPixels - (optional) The maximum supported canvas * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
* size in total pixels, i.e. width * height. Use -1 for no limit. * total pixels, i.e. width * height. Use -1 for no limit. The default value
* The default value is 4096 * 4096 (16 mega-pixels). * is 4096 * 4096 (16 mega-pixels).
* @property {IL10n} l10n - Localization service. * @property {IL10n} l10n - Localization service.
*/ */
@ -179,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;
@ -210,7 +209,7 @@ class BaseViewer {
} }
/** /**
* @return {boolean} Whether the pageNumber is valid (within bounds). * @returns {boolean} Whether the pageNumber is valid (within bounds).
* @private * @private
*/ */
_setCurrentPageNumber(val, resetCurrentPageView = false) { _setCurrentPageNumber(val, resetCurrentPageView = false) {
@ -239,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];
@ -268,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 :
@ -289,7 +288,7 @@ class BaseViewer {
} }
/** /**
* @returns {string} * @type {string}
*/ */
get currentScaleValue() { get currentScaleValue() {
return this._currentScaleValue; return this._currentScaleValue;
@ -306,7 +305,7 @@ class BaseViewer {
} }
/** /**
* @returns {number} * @type {number}
*/ */
get pagesRotation() { get pagesRotation() {
return this._pagesRotation; return this._pagesRotation;
@ -666,10 +665,10 @@ class BaseViewer {
/** /**
* @typedef ScrollPageIntoViewParameters * @typedef ScrollPageIntoViewParameters
* @property {number} pageNumber - The page number. * @property {number} pageNumber - The page number.
* @property {Array} destArray - (optional) The original PDF destination * @property {Array} [destArray] - The original PDF destination array, in the
* array, in the format: <page-ref> </XYZ|/FitXXX> <args..> * format: <page-ref> </XYZ|/FitXXX> <args..>
* @property {boolean} allowNegativeOffset - (optional) Allow negative page * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.
* offsets. The default value is `false`. * The default value is `false`.
*/ */
/** /**
@ -1009,8 +1008,8 @@ class BaseViewer {
/** /**
* @param {HTMLDivElement} pageDiv * @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage * @param {PDFPage} pdfPage
* @param {string} imageResourcesPath - (optional) Path for image resources, * @param {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderInteractiveForms * @param {boolean} renderInteractiveForms
* @param {IL10n} l10n * @param {IL10n} l10n
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}
@ -1030,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];
@ -1075,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;
@ -1121,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;

View File

@ -30,11 +30,11 @@ let ChromeCom = {
* Creates an event that the extension is listening for and will * Creates an event that the extension is listening for and will
* asynchronously respond by calling the callback. * asynchronously respond by calling the callback.
* *
* @param {String} action The action to trigger. * @param {string} action - The action to trigger.
* @param {String} data Optional data to send. * @param {string} [data] - The data to send.
* @param {Function} callback Optional response callback that will be called * @param {Function} [callback] - Response callback that will be called with
* with one data argument. When the request cannot be handled, the callback * one data argument. When the request cannot be handled, the callback is
* is immediately invoked with no arguments. * immediately invoked with no arguments.
*/ */
request(action, data, callback) { request(action, data, callback) {
let message = { let message = {
@ -56,7 +56,7 @@ let ChromeCom = {
/** /**
* Resolves a PDF file path and attempts to detects length. * Resolves a PDF file path and attempts to detects length.
* *
* @param {String} file - Absolute URL of PDF file. * @param {string} file - Absolute URL of PDF file.
* @param {OverlayManager} overlayManager - Manager for the viewer overlays. * @param {OverlayManager} overlayManager - Manager for the viewer overlays.
* @param {Function} callback - A callback with resolved URL and file length. * @param {Function} callback - A callback with resolved URL and file length.
*/ */

View File

@ -32,9 +32,9 @@ let FirefoxCom = (function FirefoxComClosure() {
* synchronously respond to. * synchronously respond to.
* NOTE: It is reccomended to use request() instead since one day we may not * NOTE: It is reccomended to use request() instead since one day we may not
* be able to synchronously reply. * be able to synchronously reply.
* @param {String} action The action to trigger. * @param {string} action - The action to trigger.
* @param {String} data Optional data to send. * @param {string} [data] - The data to send.
* @return {*} The response. * @returns {*} The response.
*/ */
requestSync(action, data) { requestSync(action, data) {
let request = document.createTextNode(''); let request = document.createTextNode('');
@ -52,10 +52,10 @@ let FirefoxCom = (function FirefoxComClosure() {
/** /**
* Creates an event that the extension is listening for and will * Creates an event that the extension is listening for and will
* asynchronously respond by calling the callback. * asynchronously respond by calling the callback.
* @param {String} action The action to trigger. * @param {string} action - The action to trigger.
* @param {String} data Optional data to send. * @param {string} [data] - The data to send.
* @param {Function} callback Optional response callback that will be called * @param {Function} [callback] - Response callback that will be called
* with one data argument. * with one data argument.
*/ */
request(action, data, callback) { request(action, data, callback) {
let request = document.createTextNode(''); let request = document.createTextNode('');

View File

@ -93,7 +93,7 @@ GrabToPan.prototype = {
* Override this method to change the default behaviour. * Override this method to change the default behaviour.
* *
* @param node {Element} The target of the event * @param node {Element} The target of the event
* @return {boolean} Whether to not react to the click event. * @returns {boolean} Whether to not react to the click event.
*/ */
ignoreTarget: function GrabToPan_ignoreTarget(node) { ignoreTarget: function GrabToPan_ignoreTarget(node) {
// Use matchesSelector to check whether the clicked element // Use matchesSelector to check whether the clicked element
@ -205,8 +205,8 @@ var isSafari6plus = /Apple/.test(navigator.vendor) &&
/** /**
* Whether the left mouse is not pressed. * Whether the left mouse is not pressed.
* @param event {MouseEvent} * @param event {MouseEvent}
* @return {boolean} True if the left mouse button is not pressed. * @returns {boolean} True if the left mouse button is not pressed,
* False if unsure or if the left mouse button is pressed. * False if unsure or if the left mouse button is pressed.
*/ */
function isLeftMouseReleased(event) { function isLeftMouseReleased(event) {
if ('buttons' in event && isNotIEorIsIE10plus) { if ('buttons' in event && isNotIEorIsIE10plus) {

View File

@ -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() {}
@ -156,8 +156,8 @@ class IPDFAnnotationLayerFactory {
/** /**
* @param {HTMLDivElement} pageDiv * @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage * @param {PDFPage} pdfPage
* @param {string} imageResourcesPath - (optional) Path for image resources, * @param {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @param {boolean} renderInteractiveForms * @param {boolean} renderInteractiveForms
* @param {IL10n} l10n * @param {IL10n} l10n
* @returns {AnnotationLayerBuilder} * @returns {AnnotationLayerBuilder}

View File

@ -27,13 +27,13 @@ class OverlayManager {
/** /**
* @param {string} name - The name of the overlay that is registered. * @param {string} name - The name of the overlay that is registered.
* @param {HTMLDivElement} element - The overlay's DOM element. * @param {HTMLDivElement} element - The overlay's DOM element.
* @param {function} callerCloseMethod - (optional) The method that, if * @param {function} [callerCloseMethod] - The method that, if present, calls
* present, calls `OverlayManager.close` from the object * `OverlayManager.close` from the object registering the
* registering the overlay. Access to this method is * overlay. Access to this method is necessary in order to
* necessary in order to run cleanup code when e.g. * run cleanup code when e.g. the overlay is force closed.
* the overlay is force closed. The default is `null`. * The default is `null`.
* @param {boolean} canForceClose - (optional) Indicates if opening the * @param {boolean} [canForceClose] - Indicates if opening the overlay closes
* overlay closes an active overlay. The default is `false`. * an active overlay. The default is `false`.
* @returns {Promise} A promise that is resolved when the overlay has been * @returns {Promise} A promise that is resolved when the overlay has been
* registered. * registered.
*/ */

View File

@ -25,9 +25,9 @@ const CursorTool = {
* @typedef {Object} PDFCursorToolsOptions * @typedef {Object} PDFCursorToolsOptions
* @property {HTMLDivElement} container - The document container. * @property {HTMLDivElement} container - The document container.
* @property {EventBus} eventBus - The application event bus. * @property {EventBus} eventBus - The application event bus.
* @property {number} cursorToolOnLoad - (optional) The cursor tool that will be * @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled
* enabled on load; the constants from {CursorTool} should be used. * on load; the constants from {CursorTool} should be used. The default value
* The default value is `CursorTool.SELECT`. * is `CursorTool.SELECT`.
*/ */
class PDFCursorTools { class PDFCursorTools {
@ -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;

View File

@ -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) {

View File

@ -33,15 +33,15 @@ const UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds
/** /**
* @typedef {Object} InitializeParameters * @typedef {Object} InitializeParameters
* @property {string} fingerprint - The PDF document's unique fingerprint. * @property {string} fingerprint - The PDF document's unique fingerprint.
* @property {boolean} resetHistory - (optional) Reset the browsing history. * @property {boolean} [resetHistory] - Reset the browsing history.
* @property {boolean} updateUrl - (optional) Attempt to update the document * @property {boolean} [updateUrl] - Attempt to update the document URL, with
* URL, with the current hash, when pushing/replacing browser history entries. * the current hash, when pushing/replacing browser history entries.
*/ */
/** /**
* @typedef {Object} PushParameters * @typedef {Object} PushParameters
* @property {string} namedDest - (optional) The named destination. If absent, * @property {string} [namedDest] - The named destination. If absent, a
* a stringified version of `explicitDest` is used. * stringified version of `explicitDest` is used.
* @property {Array} explicitDest - The explicit destination array. * @property {Array} explicitDest - The explicit destination array.
* @property {number} pageNumber - The page to which the destination points. * @property {number} pageNumber - The page to which the destination points.
*/ */
@ -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() {

View File

@ -18,11 +18,11 @@ import { getGlobalEventBus, parseQueryString } from './ui_utils';
/** /**
* @typedef {Object} PDFLinkServiceOptions * @typedef {Object} PDFLinkServiceOptions
* @property {EventBus} eventBus - The application event bus. * @property {EventBus} eventBus - The application event bus.
* @property {number} externalLinkTarget - (optional) Specifies the `target` * @property {number} [externalLinkTarget] - Specifies the `target` attribute
* attribute for external links. Must use one of the values from {LinkTarget}. * for external links. Must use one of the values from {LinkTarget}.
* Defaults to using no target. * Defaults to using no target.
* @property {string} externalLinkRel - (optional) Specifies the `rel` attribute * @property {string} [externalLinkRel] - Specifies the `rel` attribute for
* for external links. Defaults to stripping the referrer. * external links. Defaults to stripping the referrer.
*/ */
/** /**
@ -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;
@ -189,7 +189,7 @@ class PDFLinkService {
/** /**
* Prefix the full url on anchor links to make sure that links are resolved * Prefix the full url on anchor links to make sure that links are resolved
* relative to the current URL instead of the one defined in <base href>. * relative to the current URL instead of the one defined in <base href>.
* @param {String} anchor The anchor hash, including the #. * @param {string} anchor The anchor hash, including the #.
* @returns {string} The hyperlink to the PDF object. * @returns {string} The hyperlink to the PDF object.
*/ */
getAnchorUrl(anchor) { getAnchorUrl(anchor) {
@ -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;

View File

@ -32,23 +32,23 @@ import { viewerCompatibilityParams } from './viewer_compatibility';
* @property {PageViewport} defaultViewport - The page viewport. * @property {PageViewport} defaultViewport - The page viewport.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object. * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
* @property {IPDFTextLayerFactory} textLayerFactory * @property {IPDFTextLayerFactory} textLayerFactory
* @property {number} textLayerMode - (optional) Controls if the text layer used * @property {number} [textLayerMode] - Controls if the text layer used for
* for selection and searching is created, and if the improved text selection * selection and searching is created, and if the improved text selection
* behaviour is enabled. The constants from {TextLayerMode} should be used. * behaviour is enabled. The constants from {TextLayerMode} should be used.
* The default value is `TextLayerMode.ENABLE`. * The default value is `TextLayerMode.ENABLE`.
* @property {IPDFAnnotationLayerFactory} annotationLayerFactory * @property {IPDFAnnotationLayerFactory} annotationLayerFactory
* @property {string} imageResourcesPath - (optional) Path for image resources, * @property {string} [imageResourcesPath] - Path for image resources, mainly
* mainly for annotation icons. Include trailing slash. * for annotation icons. Include trailing slash.
* @property {boolean} renderInteractiveForms - Turns on rendering of * @property {boolean} renderInteractiveForms - Turns on rendering of
* interactive form elements. The default is `false`. * interactive form elements. The default is `false`.
* @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'. * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.
* @property {boolean} enableWebGL - (optional) Enables WebGL accelerated * @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering for
* rendering for some operations. The default value is `false`. * some operations. The default value is `false`.
* @property {boolean} useOnlyCssZoom - (optional) Enables CSS only zooming. * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default
* The default value is `false`. * value is `false`.
* @property {number} maxCanvasPixels - (optional) The maximum supported canvas * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
* size in total pixels, i.e. width * height. Use -1 for no limit. * total pixels, i.e. width * height. Use -1 for no limit. The default value
* The default value is 4096 * 4096 (16 mega-pixels). * is 4096 * 4096 (16 mega-pixels).
* @property {IL10n} l10n - Localization service. * @property {IL10n} l10n - Localization service.
*/ */

View File

@ -32,11 +32,11 @@ const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
/** /**
* @typedef {Object} PDFPresentationModeOptions * @typedef {Object} PDFPresentationModeOptions
* @property {HTMLDivElement} container - The container for the viewer element. * @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} viewer - (optional) The viewer element. * @property {HTMLDivElement} [viewer] - The viewer element.
* @property {PDFViewer} pdfViewer - The document viewer. * @property {PDFViewer} pdfViewer - The document viewer.
* @property {EventBus} eventBus - The application event bus. * @property {EventBus} eventBus - The application event bus.
* @property {Array} contextMenuItems - (optional) The menu items that are added * @property {Array} [contextMenuItems] - The menu items that are added to the
* to the context menu in Presentation Mode. * context menu in Presentation Mode.
*/ */
class PDFPresentationMode { class PDFPresentationMode {

View File

@ -34,8 +34,8 @@ const SidebarView = {
* @property {PDFThumbnailViewer} pdfThumbnailViewer - The thumbnail viewer. * @property {PDFThumbnailViewer} pdfThumbnailViewer - The thumbnail viewer.
* @property {EventBus} eventBus - The application event bus. * @property {EventBus} eventBus - The application event bus.
* @property {IL10n} l10n - The localization service. * @property {IL10n} l10n - The localization service.
* @property {boolean} disableNotification - (optional) Disable the notification * @property {boolean} [disableNotification] - Disable the notification for
* for documents containing outline/attachments. The default value is `false`. * documents containing outline/attachments. The default value is `false`.
*/ */
/** /**
@ -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);
@ -153,8 +153,8 @@ class PDFSidebar {
/** /**
* @param {number} view - The sidebar view that should be switched to, * @param {number} view - The sidebar view that should be switched to,
* must be one of the values in {SidebarView}. * must be one of the values in {SidebarView}.
* @param {boolean} forceOpen - (optional) Ensure that the sidebar is open. * @param {boolean} [forceOpen] - Ensure that the sidebar is open.
* The default value is `false`. * The default value is `false`.
*/ */
switchView(view, forceOpen = false) { switchView(view, forceOpen = false) {
this._switchView(view, forceOpen); this._switchView(view, forceOpen);

View File

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

View File

@ -30,9 +30,9 @@ const THUMBNAIL_WIDTH = 98; // px
* @property {PageViewport} defaultViewport - The page viewport. * @property {PageViewport} defaultViewport - The page viewport.
* @property {IPDFLinkService} linkService - The navigation/linking service. * @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object. * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
* @property {boolean} disableCanvasToImageConversion - (optional) Don't convert * @property {boolean} [disableCanvasToImageConversion] - Don't convert the
* the canvas thumbnails to images. This prevents `toDataURL` calls, * canvas thumbnails to images. This prevents `toDataURL` calls, but
* but increases the overall memory usage. The default value is `false`. * increases the overall memory usage. The default value is `false`.
* @property {IL10n} l10n - Localization service. * @property {IL10n} l10n - Localization service.
*/ */

View File

@ -83,8 +83,8 @@ class BasePreferences {
/** /**
* Stub function for writing preferences to storage. * Stub function for writing preferences to storage.
* @param {Object} prefObj The preferences that should be written to storage. * @param {Object} prefObj The preferences that should be written to storage.
* @return {Promise} A promise that is resolved when the preference values * @returns {Promise} A promise that is resolved when the preference values
* have been written. * have been written.
*/ */
async _writeToStorage(prefObj) { async _writeToStorage(prefObj) {
throw new Error('Not implemented: _writeToStorage'); throw new Error('Not implemented: _writeToStorage');
@ -93,8 +93,8 @@ class BasePreferences {
/** /**
* Stub function for reading preferences from storage. * Stub function for reading preferences from storage.
* @param {Object} prefObj The preferences that should be read from storage. * @param {Object} prefObj The preferences that should be read from storage.
* @return {Promise} A promise that is resolved with an {Object} containing * @returns {Promise} A promise that is resolved with an {Object} containing
* the preferences that have been read. * the preferences that have been read.
*/ */
async _readFromStorage(prefObj) { async _readFromStorage(prefObj) {
throw new Error('Not implemented: _readFromStorage'); throw new Error('Not implemented: _readFromStorage');
@ -102,8 +102,8 @@ class BasePreferences {
/** /**
* Reset the preferences to their default values and update storage. * Reset the preferences to their default values and update storage.
* @return {Promise} A promise that is resolved when the preference values * @returns {Promise} A promise that is resolved when the preference values
* have been reset. * have been reset.
*/ */
async reset() { async reset() {
await this._initializedPromise; await this._initializedPromise;
@ -115,8 +115,8 @@ class BasePreferences {
* Set the value of a preference. * Set the value of a preference.
* @param {string} name The name of the preference that should be changed. * @param {string} name The name of the preference that should be changed.
* @param {boolean|number|string} value The new value of the preference. * @param {boolean|number|string} value The new value of the preference.
* @return {Promise} A promise that is resolved when the value has been set, * @returns {Promise} A promise that is resolved when the value has been set,
* provided that the preference exists and the types match. * provided that the preference exists and the types match.
*/ */
async set(name, value) { async set(name, value) {
await this._initializedPromise; await this._initializedPromise;
@ -149,8 +149,8 @@ class BasePreferences {
/** /**
* Get the value of a preference. * Get the value of a preference.
* @param {string} name The name of the preference whose value is requested. * @param {string} name The name of the preference whose value is requested.
* @return {Promise} A promise that is resolved with a {boolean|number|string} * @returns {Promise} A promise resolved with a {boolean|number|string}
* containing the value of the preference. * containing the value of the preference.
*/ */
async get(name) { async get(name) {
await this._initializedPromise; await this._initializedPromise;
@ -170,8 +170,8 @@ class BasePreferences {
/** /**
* Get the values of all preferences. * Get the values of all preferences.
* @return {Promise} A promise that is resolved with an {Object} containing * @returns {Promise} A promise that is resolved with an {Object} containing
* the values of all preferences. * the values of all preferences.
*/ */
async getAll() { async getAll() {
await this._initializedPromise; await this._initializedPromise;

View File

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

View File

@ -79,8 +79,8 @@ class TextLayerBuilder {
/** /**
* Renders the text layer. * Renders the text layer.
* *
* @param {number} timeout - (optional) wait for a specified amount of * @param {number} [timeout] - Wait for a specified amount of milliseconds
* milliseconds before rendering * before rendering.
*/ */
render(timeout = 0) { render(timeout = 0) {
if (!(this.textContent || this.textContentStream) || this.renderingDone) { if (!(this.textContent || this.textContentStream) || this.renderingDone) {

View File

@ -87,9 +87,9 @@ let NullL10n = {
/** /**
* Returns scale factor for the canvas. It makes sense for the HiDPI displays. * Returns scale factor for the canvas. It makes sense for the HiDPI displays.
* @return {Object} The object with horizontal (sx) and vertical (sy) * @returns {Object} The object with horizontal (sx) and vertical (sy)
scales. The scaled property is set to false if scaling is * scales. The scaled property is set to false if scaling is
not required, true otherwise. * not required, true otherwise.
*/ */
function getOutputScale(ctx) { function getOutputScale(ctx) {
let devicePixelRatio = window.devicePixelRatio || 1; let devicePixelRatio = window.devicePixelRatio || 1;
@ -215,7 +215,7 @@ function parseQueryString(query) {
* that if the condition is true for one item in the array, then it is also true * that if the condition is true for one item in the array, then it is also true
* for all following items. * for all following items.
* *
* @returns {Number} Index of the first array element to pass the test, * @returns {number} Index of the first array element to pass the test,
* or |items.length| if no such element exists. * or |items.length| if no such element exists.
*/ */
function binarySearchFirstItem(items, condition) { function binarySearchFirstItem(items, condition) {
@ -296,7 +296,7 @@ function roundToDivide(x, div) {
* Gets the size of the specified page, converted from PDF units to inches. * Gets the size of the specified page, converted from PDF units to inches.
* @param {Object} An Object containing the properties: {Array} `view`, * @param {Object} An Object containing the properties: {Array} `view`,
* {number} `userUnit`, and {number} `rotate`. * {number} `userUnit`, and {number} `rotate`.
* @return {Object} An Object containing the properties: {number} `width` * @returns {Object} An Object containing the properties: {number} `width`
* and {number} `height`, given in inches. * and {number} `height`, given in inches.
*/ */
function getPageSizeInches({ view, userUnit, rotate, }) { function getPageSizeInches({ view, userUnit, rotate, }) {