Skip to content

Commit

Permalink
Merge pull request #11294 from Snuffleupagus/rm-non-PRODUCTION-require
Browse files Browse the repository at this point in the history
Remove some unused `require` statements, used when loading fake workers, in non-`PRODUCTION` mode
  • Loading branch information
timvandermeij authored Oct 31, 2019
2 parents 72bd8e8 + eedd449 commit c807637
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
11 changes: 2 additions & 9 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1569,16 +1569,9 @@ const PDFWorker = (function PDFWorkerClosure() {
SystemJS.import('pdfjs/core/worker').then((worker) => {
fakeWorkerFilesLoadedCapability.resolve(worker.WorkerMessageHandler);
}).catch(fakeWorkerFilesLoadedCapability.reject);
} else if (typeof require === 'function') {
try {
const worker = require('../core/worker.js');
fakeWorkerFilesLoadedCapability.resolve(worker.WorkerMessageHandler);
} catch (ex) {
fakeWorkerFilesLoadedCapability.reject(ex);
}
} else {
fakeWorkerFilesLoadedCapability.reject(new Error(
'SystemJS or CommonJS must be used to load fake worker.'));
fakeWorkerFilesLoadedCapability.reject(
new Error('SystemJS must be used to load fake worker.'));
}
} else {
const loader = fakeWorkerFilesLoader || function() {
Expand Down
10 changes: 1 addition & 9 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1532,16 +1532,8 @@ function loadFakeWorker() {
window.pdfjsWorker = worker;
resolve();
}).catch(reject);
} else if (typeof require === 'function') {
try {
window.pdfjsWorker = require('../src/core/worker.js');
resolve();
} catch (ex) {
reject(ex);
}
} else {
reject(new Error(
'SystemJS or CommonJS must be used to load fake worker.'));
reject(new Error('SystemJS must be used to load fake worker.'));
}
});
}
Expand Down
9 changes: 1 addition & 8 deletions web/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ function getDefaultPreferences() {
defaultPreferences = new Promise(function(resolve, reject) {
if (typeof SystemJS === 'object') {
SystemJS.import('./app_options').then(resolve, reject);
} else if (typeof require === 'function') {
try {
resolve(require('./app_options.js'));
} catch (ex) {
reject(ex);
}
} else {
reject(new Error(
'SystemJS or CommonJS must be used to load AppOptions.'));
reject(new Error('SystemJS must be used to load AppOptions.'));
}
}).then(function({ AppOptions, OptionKind, }) {
return AppOptions.getAll(OptionKind.PREFERENCE);
Expand Down

0 comments on commit c807637

Please sign in to comment.