Remove the _ensureDownloadComplete helper method in web/app.js

After the previous commit this method has only a single call-site, hence we can inline the needed part of that check directly in `PDFViewerApplication.download` instead.
This commit is contained in:
Jonas Jenwald 2024-06-15 17:45:38 +02:00
parent 7c5e9cf8be
commit f4912db2ae

View file

@ -1073,22 +1073,12 @@ const PDFViewerApplication = {
); );
}, },
/**
* @private
*/
_ensureDownloadComplete() {
if (this.pdfDocument && this.downloadComplete) {
return;
}
throw new Error("PDF document not downloaded.");
},
async download(options = {}) { async download(options = {}) {
let data; let data;
try { try {
this._ensureDownloadComplete(); if (this.downloadComplete) {
data = await this.pdfDocument.getData(); data = await this.pdfDocument.getData();
}
} catch { } catch {
// When the PDF document isn't ready, or the PDF file is still // When the PDF document isn't ready, or the PDF file is still
// downloading, simply download using the URL. // downloading, simply download using the URL.