question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Worker loaded every time the document changes

See original GitHub issue

I have a simple viewer based mostly on pdfjs-dist. The viewer has a document list and it displays one document at a time. However, when I change the document, the worker is requested and downloaded again. Can’t the worker just be downloaded once and use for subsequent document changes?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
yurydelendikcommented, Mar 3, 2016

For use with multiple requests:

var worker = new PDFJS.PDFWorker('test1');
var loadingTask1 = PDFJS.getDocument({url: url1, worker: worker});
var loadingTask2 = PDFJS.getDocument({url: url2, worker: worker});
...
loadingTask1.destroy();
loadingTask2.destroy();
worker.destroy();
0reactions
akhil-sharma-10bcommented, Aug 27, 2021

@babukandi Import * as pdfjs from {pdf js-dist/build/pdfjs} Set workerSrc =

  1. Create worker object Var worker = new pdfjs.PDFWorker();
  2. Pass object to get Document Pdfjs.getDocument({ url:pdf url, worker:worker }).then();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Examples of Loading Work Relationship Changes
This topic provides examples of work-relationship changes that you request using ... (GlobalTransferFlag) on the same work relationship at the same time.
Read more >
Cloud Firestore triggers | Cloud Functions for Firebase
If you want to trigger an event for any change to a specific document then ... You can trigger a function to fire...
Read more >
Using Web Workers - Web APIs - MDN Web Docs
The onmessage handler allows us to run some code whenever a message ... shared workers cannot be shared between documents loaded in private ......
Read more >
Troubleshoot common coauthoring errors - Microsoft Support
Upload Failed: Save as / Discard. Upload Fail Save As / Discard. Experience: The error bar appears, AutoSave turns off, and no more...
Read more >
The service worker lifecycle - web.dev
Without service workers, users can load one tab to your site, ... This can result in two versions of your site running at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found