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:
parent
b6765403a1
commit
5e50479ac6
1 changed files with 6 additions and 5 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue