This particular JSDoc comment is fairly old and it also contains some now unrelated/confusing information. The only way to *guarantee* that the PDF.js library works as expected is to correctly set the global `workerSrc`[1], hence giving the impression that the option isn't strictly necessary is thus incorrect. --- [1] Since advertising the fallbackWorkerSrc functionality definitely seems like the *wrong* thing to do.
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
/* Copyright 2018 Mozilla Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const GlobalWorkerOptions = Object.create(null);
|
|
|
|
/**
|
|
* Defines global port for worker process. Overrides the `workerSrc` option.
|
|
* @var {Object}
|
|
*/
|
|
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
|
|
? ""
|
|
: GlobalWorkerOptions.workerSrc;
|
|
|
|
export { GlobalWorkerOptions };
|