Skip to content

Commit

Permalink
Remove the _ensureDownloadComplete helper method in web/app.js
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Snuffleupagus committed Jun 15, 2024
1 parent 7c5e9cf commit 7813d07
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,22 +1073,13 @@ 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.
Expand Down

0 comments on commit 7813d07

Please sign in to comment.