mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-10 07:14:04 +02:00
Change the "Terminate" worker-thread handler to an asynchronous function
This is a tiny bit shorter, which cannot hurt.
This commit is contained in:
parent
e8ab3cb335
commit
7f4e29ed22
@ -956,7 +956,7 @@ class WorkerMessageHandler {
|
||||
return pdfManager.cleanup(/* manuallyTriggered = */ true);
|
||||
});
|
||||
|
||||
handler.on("Terminate", function (data) {
|
||||
handler.on("Terminate", async function (data) {
|
||||
terminated = true;
|
||||
|
||||
const waitOn = [];
|
||||
@ -977,12 +977,11 @@ class WorkerMessageHandler {
|
||||
task.terminate();
|
||||
}
|
||||
|
||||
return Promise.all(waitOn).then(function () {
|
||||
// Notice that even if we destroying handler, resolved response promise
|
||||
// must be sent back.
|
||||
handler.destroy();
|
||||
handler = null;
|
||||
});
|
||||
await Promise.all(waitOn);
|
||||
// Notice that even if we destroying handler, resolved response promise
|
||||
// must be sent back.
|
||||
handler.destroy();
|
||||
handler = null;
|
||||
});
|
||||
|
||||
handler.on("Ready", function (data) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user