1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Use more object destructuring in the "commonobj" handler in the API

This commit is contained in:
Jonas Jenwald 2024-05-10 12:03:10 +02:00
parent b6765403a1
commit 5e50479ac6

View file

@ -2750,7 +2750,8 @@ class WorkerTransport {
switch (type) {
case "Font":
const params = this._params;
const { disableFontFace, fontExtraProperties, ignoreErrors, pdfBug } =
this._params;
if ("error" in exportedData) {
const exportedError = exportedData.error;
@ -2760,12 +2761,12 @@ class WorkerTransport {
}
const inspectFont =
params.pdfBug && globalThis.FontInspector?.enabled
pdfBug && globalThis.FontInspector?.enabled
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
: null;
const font = new FontFaceObject(exportedData, {
disableFontFace: params.disableFontFace,
ignoreErrors: params.ignoreErrors,
disableFontFace,
ignoreErrors,
inspectFont,
});
@ -2773,7 +2774,7 @@ class WorkerTransport {
.bind(font)
.catch(() => messageHandler.sendWithPromise("FontFallback", { id }))
.finally(() => {
if (!params.fontExtraProperties && font.data) {
if (!fontExtraProperties && font.data) {
// Immediately release the `font.data` property once the font
// has been attached to the DOM, since it's no longer needed,
// rather than waiting for a `PDFDocumentProxy.cleanup` call.