mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
[api-major] Remove the PDFJS.disableWorker
option
Despite this patch removing the `disableWorker` option itself, please note that we'll still fallback to loading the worker file(s) on the main-thread when running in environments without proper Web Worker support. Furthermore it's still possible, even with this patch, to force the use of fake workers by manually loading the necessary file using a `<script>` tag on the main-thread.[1] That way, the functionality of the now removed `SINGLE_FILE` build target and the resulting `build/pdf.combined.js` file can still be achieved simply by adding e.g. `<script src="build/pdf.worker.js"></script>` to the HTML (obviously with the path adjusted as needed). Finally note that the `disableWorker` option is a performance footgun, and unfortunately many existing third-party examples actually use it without providing any sort of warning/justification. --- [1] This approach is used in the default viewer, since certain kind of debugging may be easier if the code is running directly on the main-thread.
This commit is contained in:
parent
a5aaf62754
commit
56a8c934dd
11 changed files with 64 additions and 57 deletions
|
@ -10,9 +10,6 @@ var pdfPath = '../helloworld/helloworld.pdf';
|
|||
// Setting worker path to worker bundle.
|
||||
PDFJS.workerSrc = '../../build/browserify/pdf.worker.bundle.js';
|
||||
|
||||
// It is also possible to disable workers via `PDFJS.disableWorker = true`,
|
||||
// however that might degrade the UI performance in web browsers.
|
||||
|
||||
// Loading a document.
|
||||
var loadingTask = PDFJS.getDocument(pdfPath);
|
||||
loadingTask.promise.then(function (pdfDocument) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue