Merge pull request #12160 from tamuratak/worker_options

Use typedef to define the type of GlobalWorkerOptions (PR 12102 follow-up)
This commit is contained in:
Tim van der Meij 2020-08-03 22:55:49 +02:00 committed by GitHub
commit e68ac05f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,24 +13,25 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* @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); const GlobalWorkerOptions = Object.create(null);
/**
* Defines global port for worker process. Overrides the `workerSrc` option.
* @var {Object}
*/
GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort =
GlobalWorkerOptions.workerPort === undefined GlobalWorkerOptions.workerPort === undefined
? null ? null
: GlobalWorkerOptions.workerPort; : 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 =
GlobalWorkerOptions.workerSrc === undefined GlobalWorkerOptions.workerSrc === undefined
? "" ? ""