Add (some) optional chaining usage in src/display/api.js

Since we no longer use SystemJS to load the unit-tests, there's now nothing that prevents us from using optional chaining and nullish coalescing in the `src/display/` directory.
This commit is contained in:
Jonas Jenwald 2020-10-25 14:17:28 +01:00
parent 1c4495843c
commit c293fc2b8f

View File

@ -1168,8 +1168,7 @@ class PDFPageProxy {
pageIndex: this._pageIndex, pageIndex: this._pageIndex,
intent: renderingIntent, intent: renderingIntent,
renderInteractiveForms: renderInteractiveForms === true, renderInteractiveForms: renderInteractiveForms === true,
annotationStorage: annotationStorage: annotationStorage?.getAll() || null,
(annotationStorage && annotationStorage.getAll()) || null,
}); });
} }
@ -2551,8 +2550,7 @@ class WorkerTransport {
return this.messageHandler return this.messageHandler
.sendWithPromise("SaveDocument", { .sendWithPromise("SaveDocument", {
numPages: this._numPages, numPages: this._numPages,
annotationStorage: annotationStorage: annotationStorage?.getAll() || null,
(annotationStorage && annotationStorage.getAll()) || null,
filename: this._fullReader ? this._fullReader.filename : null, filename: this._fullReader ? this._fullReader.filename : null,
}) })
.finally(() => { .finally(() => {