mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Adds UMD header to pdf.js and pdf.worker.js files.
This commit is contained in:
parent
e8db825512
commit
cbbb9bb82d
6 changed files with 77 additions and 39 deletions
|
@ -12,6 +12,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* globals pdfjsFilePath */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1177,6 +1178,18 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
|||
var PDFWorker = (function PDFWorkerClosure() {
|
||||
var nextFakeWorkerId = 0;
|
||||
|
||||
function getWorkerSrc() {
|
||||
if (PDFJS.workerSrc) {
|
||||
return PDFJS.workerSrc;
|
||||
}
|
||||
//#if PRODUCTION && !(MOZCENTRAL || FIREFOX)
|
||||
// if (pdfjsFilePath) {
|
||||
// return pdfjsFilePath.replace(/\.js$/i, '.worker.js');
|
||||
// }
|
||||
//#endif
|
||||
error('No PDFJS.workerSrc specified');
|
||||
}
|
||||
|
||||
// Loads worker code into main thread.
|
||||
function setupFakeWorkerGlobal() {
|
||||
if (!PDFJS.fakeWorkerFilesLoadedCapability) {
|
||||
|
@ -1201,7 +1214,7 @@ var PDFWorker = (function PDFWorkerClosure() {
|
|||
//#endif
|
||||
//#if PRODUCTION && !SINGLE_FILE
|
||||
// var loader = fakeWorkerFilesLoader || function (callback) {
|
||||
// Util.loadScript(PDFJS.workerSrc, callback);
|
||||
// Util.loadScript(getWorkerSrc(), callback);
|
||||
// };
|
||||
// loader(function () {
|
||||
// PDFJS.fakeWorkerFilesLoadedCapability.resolve();
|
||||
|
@ -1243,10 +1256,7 @@ var PDFWorker = (function PDFWorkerClosure() {
|
|||
// Uint8Array as it arrives on the worker. (Chrome added this with v.15.)
|
||||
//#if !SINGLE_FILE
|
||||
if (!globalScope.PDFJS.disableWorker && typeof Worker !== 'undefined') {
|
||||
var workerSrc = PDFJS.workerSrc;
|
||||
if (!workerSrc) {
|
||||
error('No PDFJS.workerSrc specified');
|
||||
}
|
||||
var workerSrc = getWorkerSrc();
|
||||
|
||||
try {
|
||||
// Some versions of FF can't create a worker on localhost, see:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue