Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use typedef to define the type of GlobalWorkerOptions (PR 12102 follow-up) #12160

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/display/worker_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@
* limitations under the License.
*/

const GlobalWorkerOptions = Object.create(null);

/**
* Defines global port for worker process. Overrides the `workerSrc` option.
* @var {Object}
* @typedef {Object} GlobalWorkerOptionsType
* @property {Worker | null} workerPort - Defines global port for worker
* process. Overrides the `workerSrc` option.
* @property {string} workerSrc - A string containing the path and filename
* of the worker file.
*
* NOTE: The `workerSrc` option should always be set, in order to prevent any
* issues when using the PDF.js library.
*/

/** @type {GlobalWorkerOptionsType} */
const GlobalWorkerOptions = Object.create(null);

GlobalWorkerOptions.workerPort =
GlobalWorkerOptions.workerPort === undefined
? null
: GlobalWorkerOptions.workerPort;

/**
* A string containing the path and filename of the worker file.
*
* NOTE: The `workerSrc` option should always be set, in order to prevent any
* issues when using the PDF.js library.
* @var {string}
*/
GlobalWorkerOptions.workerSrc =
GlobalWorkerOptions.workerSrc === undefined
? ""
Expand Down