Skip to content

Commit

Permalink
Use typedef to define the type of GlobalWorkerOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Aug 3, 2020
1 parent 00a8b42 commit c3fea52
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/display/worker_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,27 @@
* limitations under the License.
*/

const GlobalWorkerOptions = Object.create(null);

/**
* @typedef {Object} GlobalWorkerOptionsType
*
* @property {Worker | null} workerPort
* Defines global port for worker process. Overrides the `workerSrc` option.
* @var {Object}
*
* @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

0 comments on commit c3fea52

Please sign in to comment.