Consistently use square brackets for optional parameters in JSDoc comments

Square brackets are recommended to indicate optional parameters. Using
them helps for automatically generating correct documentation.
This commit is contained in:
Tim van der Meij 2019-10-12 16:30:32 +02:00
parent efd331daa1
commit f4daafc077
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762
21 changed files with 136 additions and 138 deletions

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

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

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

@ -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,7 +251,7 @@ class PageViewport {
/** /**
* Clones viewport, with optional additional properties. * Clones viewport, with optional additional properties.
* @param {PageViewportCloneParameters} - (optional) * @param {PageViewportCloneParameters} [params]
* @return {PageViewport} Cloned viewport. * @return {PageViewport} Cloned viewport.
*/ */
clone({ scale = this.scale, rotation = this.rotation, clone({ scale = this.scale, rotation = this.rotation,
@ -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.
*/ */
/** /**

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

@ -134,7 +134,7 @@ 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({
@ -149,7 +149,7 @@ MessageHandler.prototype = {
* 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) {
@ -174,9 +174,9 @@ MessageHandler.prototype = {
* 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. * @return {ReadableStream} ReadableStream to read data in chunks.
*/ */
sendWithStream(actionName, data, queueingStrategy, transfers) { sendWithStream(actionName, data, queueingStrategy, transfers) {

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.
*/ */
@ -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}

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 = {

View file

@ -32,8 +32,8 @@ 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. * @return {*} The response.
*/ */
requestSync(action, data) { requestSync(action, data) {
@ -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

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

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.
*/ */

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.
*/ */
/** /**

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`.
*/ */
/** /**
@ -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

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

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