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:
parent
7c5e9cf8be
commit
f4912db2ae
16
web/app.js
16
web/app.js
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user