mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Re-factor getMainThreadWorkerMessageHandler
to support arbitrary global scopes, rather than only window
This commit is contained in:
parent
a8fc306b6e
commit
71d61e4c6f
1 changed files with 5 additions and 5 deletions
|
@ -1540,12 +1540,12 @@ const PDFWorker = (function PDFWorkerClosure() {
|
|||
}
|
||||
|
||||
function getMainThreadWorkerMessageHandler() {
|
||||
let mainWorkerMessageHandler;
|
||||
try {
|
||||
if (typeof window !== 'undefined') {
|
||||
return (window.pdfjsWorker && window.pdfjsWorker.WorkerMessageHandler);
|
||||
}
|
||||
} catch (ex) { }
|
||||
return null;
|
||||
mainWorkerMessageHandler =
|
||||
globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler;
|
||||
} catch (ex) { /* Ignore errors. */ }
|
||||
return mainWorkerMessageHandler || null;
|
||||
}
|
||||
|
||||
// Loads worker code into main thread.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue