Use more object destructuring in the "commonobj" handler in the API
This commit is contained in:
parent
b6765403a1
commit
5e50479ac6
@ -2750,7 +2750,8 @@ class WorkerTransport {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "Font":
|
case "Font":
|
||||||
const params = this._params;
|
const { disableFontFace, fontExtraProperties, ignoreErrors, pdfBug } =
|
||||||
|
this._params;
|
||||||
|
|
||||||
if ("error" in exportedData) {
|
if ("error" in exportedData) {
|
||||||
const exportedError = exportedData.error;
|
const exportedError = exportedData.error;
|
||||||
@ -2760,12 +2761,12 @@ class WorkerTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const inspectFont =
|
const inspectFont =
|
||||||
params.pdfBug && globalThis.FontInspector?.enabled
|
pdfBug && globalThis.FontInspector?.enabled
|
||||||
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
|
? (font, url) => globalThis.FontInspector.fontAdded(font, url)
|
||||||
: null;
|
: null;
|
||||||
const font = new FontFaceObject(exportedData, {
|
const font = new FontFaceObject(exportedData, {
|
||||||
disableFontFace: params.disableFontFace,
|
disableFontFace,
|
||||||
ignoreErrors: params.ignoreErrors,
|
ignoreErrors,
|
||||||
inspectFont,
|
inspectFont,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2773,7 +2774,7 @@ class WorkerTransport {
|
|||||||
.bind(font)
|
.bind(font)
|
||||||
.catch(() => messageHandler.sendWithPromise("FontFallback", { id }))
|
.catch(() => messageHandler.sendWithPromise("FontFallback", { id }))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
if (!params.fontExtraProperties && font.data) {
|
if (!fontExtraProperties && font.data) {
|
||||||
// Immediately release the `font.data` property once the font
|
// Immediately release the `font.data` property once the font
|
||||||
// has been attached to the DOM, since it's no longer needed,
|
// has been attached to the DOM, since it's no longer needed,
|
||||||
// rather than waiting for a `PDFDocumentProxy.cleanup` call.
|
// rather than waiting for a `PDFDocumentProxy.cleanup` call.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user