1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

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 = {}) {
let data;
try {
this._ensureDownloadComplete();
data = await this.pdfDocument.getData();
if (this.downloadComplete) {
data = await this.pdfDocument.getData();
}
} catch {
// When the PDF document isn't ready, or the PDF file is still
// downloading, simply download using the URL.