mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 18:25:37 +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
14
web/app.js
14
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 = {}) {
|
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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue