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:
parent
7c5e9cf8be
commit
f4912db2ae
1 changed files with 3 additions and 13 deletions
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…
Add table
Add a link
Reference in a new issue